Hello Guest

Author Topic: 2D animated character running on a 3D curved terrain  (Read 4435 times)

attiksystem

  • Newbie
  • *
  • Posts: 2
    • View Profile
2D animated character running on a 3D curved terrain
« 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

« Last Edit: September 11, 2012, 10:31:22 am by attiksystem »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2D animated character running on a 3D curved terrain
« Reply #1 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.

attiksystem

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: 2D animated character running on a 3D curved terrain
« Reply #2 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...