how would I make a capsule rotate and go down a platform on the y axis?
Hi I am creating a 3d platform game , I am currently trying to make a capsule rotate to a 90 degree angle and walk down the platform? Im not sure how to start with coding this. I have added a box collider to the platform on the y-axis, and the capsule has a rigidbody with a gravity of true. I don't know wether I am suppose to set the gravity to false, and set the box collider to is trigger on and as the "player" hits the collider, the gravity changes? I have looked at everything online and nothing seemed to be working with me... Could someone please please help me.
Cast a ray downwards (in the capsule's local space) and rotate the capsule towards the hit.normal vector3.
While that might work for sloped terrain, I don't think it will work for the horizontal->vertical->horizontal example in the OP's picture: it would just drop to the bottom of the cliff. Perhaps getting the nearest terrain point using a spherecast might work better? (I'm assu$$anonymous$$g we want it to walk down the wall like an ant would, is that correct tuta?)
You are right. However, the problem that sheer cliffs might cause can be cicumvented by checking for a hit below a certain threshold, and if nothing is hit, two more rays are cast, with diagonal forward-downwards and diagonal backward-downward vectors.
Yes exactly like an ant. Ok I kind of understand what you mean, and will give it a go thanksss.