Physics relative to parent.

Hello!

I’m prototyping a fps game where you move around on big rotating platforms. Whilst on the platform you should move relative to the platform’s coordinates.
When the character lands on a platform he is added as a child to the platform’s transform and lined up so that his up vector is aligned with the platform’s normal (For gravity I’m adding a constant force in the player’s down direction). The problem is that the velocity needs to be aligned with the parent, but afaik rigidbodies doesn’t do that.
My best guess is that I have to rotate the velocity as the parent rotates(?)

Any ideas on how to solve this? Or should I approach the problem differently somehow?

Regards/Per

if your platform is a rigidbody you can read the platform velocity vectors and asign them to your player to mach the movement. Note that if you are moving the platform’s transform instead of acting over the rigidbody it woun’t work. Anyway if i had to do this i would have the platforms move arround as rigidbodies applying forces or using joints if the platform is hanging from somewhere and use material fricction or simulate player grip on the platform. This way it will be realistic and with out hardcoding anything. But just a thought in the practice it could result different as i said.

Thanks for the suggestions! I’ll have to do some more experimentation.
I guess rigidbodies aren’t meant to be used this way, but I want to avoid having to write my own physics code for this :slight_smile:
I’ve actually gotten some decent results manipulating the velocity the same amount as the player’s “up” vector has changed since the last update, still got some kinks to work out though.

Again, thanks for your time :slight_smile: