2D Toolkit Forum

2D Toolkit => Support => Topic started by: attiksystem on September 11, 2012, 10:24:50 am

Title: 2D animated character running on a 3D curved terrain
Post by: attiksystem on September 11, 2012, 10:24:50 am
Hi,

I'm using 2D Toolkit to animate the 2D sprite of a runner, moving in a 3D environment with 3D trees. On a flat terrain, there's no particular problem. But on a curved terrain, I'm still trying to figure out what is the best way to make the runner follow the curve of the terrain.

I have tried using collisions and gravity, but since the runner is a 2D mesh, I don't get the expected result at all. The runner falls down like a sheet of paper.

Any idea how to do that?

Thanks!

Philippe

Title: Re: 2D animated character running on a 3D curved terrain
Post by: unikronsoftware on September 11, 2012, 11:40:47 am
Did you constrain the rigidbody so it doesn't rotate on all axes?
In the rigidbody component, you probably want to constrain the position Z & X&Y on rotation.

If that doesn't do what you want, you could always use raycasts to sit the character properly, once you get the raycast, you will have the normal of the surface which you can use to orient the sprite.
Title: Re: 2D animated character running on a 3D curved terrain
Post by: attiksystem on September 13, 2012, 03:37:52 pm
Thanks, a constrain is really all I needed. I didn't have to use raycasting for the moment...