Does anyone know how to keep a model position on the model terrain after moving it using inputs. My scene has a blender model for the terrain and a tank asset but I can not get it to look right after moving it on even terrain. Looking at the sample I see a yawOrientation and how to get the “Y” axis of a model but it just not seem to be realistic for a tank to move that way.
I was able to find this but it does not take uneven model terrain.
Physics.PhysicsEngine.Gravity = new Vector3(0, -1000, 0);
So I found if you put a “Static Collider” component in the editor on the terrain model and then put a “Rigidbody” component on the model this causes the gravity effect. As long as you put a “Collider Shapes” entry on both the terrain and model as well. However this does not solve the problem of keeping the tank above the ground on terrain that is higher then the y axis. Still looking into that one…
After looking over documents some more I found this that talks about making a physic convex hull. Where you create an asset in the asset view from the physic folder, and then select your asset. This did the trick for me. The asset is a bit jump and seems to roll off the terrain never really stops moving just slides off the terrain even on some what flat area. So I guess that is the next step.
If you want to use physics, you can do it with your current setup. Have a look at how the Third-person platformer and the RPG templates are built (both included as samples). For tanks you should probably disallow Jump, and adjust the climbing angle. Adjusting the friction factor should help with the sliding issue.
If you want to make a game which doesn’t use physics, but it’s input and gameplay only driven, I suggest you check the Physics sample. It has one scene which uses raycasting, after moving the tank each frame you can raycast down to find the terrain height and adjust the Position.Y manually.
Both methods should work, but the gameplay will vary a little.
Awesome thank you for your thoughts on this I will try both methods just to insure we can see them both as a team.