controller hit.normal.y >0.8
platform = hit.collider So when character is grounded on any platform
My cobtroller transform.position=transform.position+Distance(platform traveled)
When platforms moving X ,Z or -Y everything is fantastic , but +Y…
Adding the platform speed to my controller VerticalVelocity component ,or keeping controller sticky to the last platform - is not right decisions.
Im trying to
if (!PhysicsRaycast (transform.position,-Vector3.up,2))
->detach my controller from platform and let em fly.But this is so noobby :shock:
animatePhysics on/off,adding rigidbodies,setting Time.fixedTime=0.0001 etc does not help
Help anyone
This was an issue I ran into a few months ago too with the Y moving platform thing. I was doing a first person style, but, maybe you can get some useful info or even use one of these. I think it’s because you’re using the Character Controller which is just about useless for vertical moving platforms (as far as I know).
Here’s a link to a couple of scripts that you can choose from that can solve that, if you’re having trouble implementing these, just ask:
The easiest way to handle this problem is to have a trigger on the platform that makes the player the child of the vertical platform while on top of it.
Of course, you’ll still need to have gravity working in order to avoid a floating character, but that’s not that big a deal. It’s only when the platform moves that the problems appear, anyway.
If you’re working with rigidbodies, you have to consider following points for elevators to work properly (and make lots of other things work better):
All operations have to be done in FixedUpdate()
All moving parts need to have a rigidbody attached, possibly with isKinematic enabled
Instead of using the Transform to move a rigidbody, use Rigidbody.MovePosition() and Rigidbody.MoveRotation()
I haven’t worked with the character controller but with these three points, most oddities with animating rigidbodies should go away.