How can i show a 3D turn table / rotating game model in a GUI.
Your question doesn’t at first glance make much sense. As I showed you in your other threads, the Unity GUI is code driven and dynamic. The GUI appears whenever the code is executed, regardless of whatever else is going on.
That being the case shouldn’t you be approaching it in terms of “How do I display a GUI on top of a rotating 3D model?”
If instead you meant to ask, “How do I get a rotating 3d model to act like a button?”, then the answer is easy. Use OnMouseDown.
I am sending you my code just run and see what i need to do.
where i have kept space for my “CAR ICON” there i want to display my “car turntable”.
MY CODE GOES LIKE THIS:------->
function OnGUI(){
for(i=0;i<3;i++){
// 3 Column Car Selection - Column 1
GUI.Box (Rect (((Screen.width/2)-470+(320i)), 200,(Screen.width/2)-340,(Screen.height/2)+30), GUIContent(“” ));//“Company Logo Screen”
GUI.Box (Rect (((Screen.width/2)-462+(320i)), 230,280,100), GUIContent(“Car Name” ));//“Company Logo Screen”
GUI.Box (Rect (((Screen.width/2)-462+(320i)), 340,280,150), GUIContent(“Car Icon” ));//“Company Logo Screen”
GUI.Box (Rect (((Screen.width/2)-462+(320i)), 500,280,150), GUIContent(“Car Stats” ));//“Company Logo Screen”
GUI.Label (Rect (((Screen.width/2)-450+(320i)), 530, 200,50), “Acceleration : 85%”);//+ xguiposition);
GUI.Label (Rect (((Screen.width/2)-450+(320i)), 570, 200,50), "Top Speed : 70% ");//+ xguiposition);
GUI.Label (Rect (((Screen.width/2)-450+(320*i)), 610, 200,50), "Handling : 70% ");//+ xguiposition);
}
}
THANKS.
<------------THEND------------>
UnityGUI will always draw on top of your in-scene elements so if you want to have rendered 3D objects appear in front of, or as part of your user interface you can have the object of interest get rendered directly to a texture by a specific camera (that camera’s only goal is to render this object) then use that texture as part of your UnityGUI set up. This requires Unity Pro as Render Textures are a Pro-only feature.
The 3d rotating car would not be part of the GUI. It is part of your 3d scene. Once your spinning car is on the screen in the proper position, simply overlay a GUI on top of it.
Is there any video to make render texture more clear and easy to understand. well i followed the steps that are mentioned in “How to create a render texture” but i did not understand this step no 4 and 5
—>
Example
A very quick way to make a live arena-camera in your game:
- Create a new Render Texture asset using Assets->Create->Render Texture.
- Create a new Camera using GameObject->Create Other->Camera.
- Assign the Render Texture to the Target Texture of the new Camera.
- Create a wide, tall and thin box
- Drag the Render Texture onto it to create a Material that uses the render texture.
- Enter Play Mode, and observe that the box’s texture is updated in real-time based on the new Camera’s output.
thanks.
Steps 4 and 5 are nothing but simply making a box primitive and applying the render texture to it as an in-scene object so you can see the texture. Replace those with using your render texture as part of your GUI.
Got that thanks