Thursday, July 4, 2024
HomeGame Developmentc# - 3D CharacterController experience shifting platforms in Unity?

c# – 3D CharacterController experience shifting platforms in Unity?


I’ve a participant controller script that I am writing that makes use of the CharacterController part to maneuver round and deal with collisions. I have been in a position to implement mainly each function that I would like apart from shifting platforms.

Some issues to notice:

-For testing functions, the platform strikes through the Replace() operate and doesn’t have a Rigidbody part connected to it. I do not suppose that rigidbodies would make a distinction within the first place, however I could possibly be flawed.

-At the moment, when my participant stands on the platform, it sort of does what it is alleged to do, however it strikes with a considerable amount of jitter. In different phrases, the participant is not in a position to depenetrate itself as quick because the platform strikes, due to this fact inflicting the jitter.

This is what I’ve tried:

My preliminary thought was to create a script on the shifting platform that retains monitor of its personal velocity. Then, on the participant’s OnControllerColliderHit(...) operate, I might get the platform’s velocity and add it to the participant’s velocity. This triggered the identical jittery impact as earlier than.

My subsequent thought was to guardian the participant to the platform every time the participant collided with it. This answer additionally didn’t work as a result of apparently CharacterControllers do NOT prefer it when they’re a baby of a shifting object. The platform’s transformations had little to no impact on the participant, no matter its velocity. So as soon as once more, the jitteriness continued.

Simply to check out doable options, I additionally tried combining the 2 earlier fixes and nonetheless, the jitteriness lives amongst us.

Closing ideas:

I am starting to suppose that it is not completely doable, however I am nonetheless holding out hope. I might additionally want to to not buy an present asset or change to a Rigidbody part as a result of neither would match the type of my recreation.

Be at liberty to ask questions for extra particulars and thanks prematurely!

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments