Hello everyone,
I’ve only just started using Unity, but I’ve been programming for around 6 years in various other game engines. I’m loving the speed of work in Unity and the simplicity compared to UE4. I’m experimenting with what kinds of things I can make Unity do, and this is one thing I’ve not successfully done in any game engine except jMonkeyEngine3
The goal is that physics are calculated with and applied to the object’s local position rather than global. The idea is to simulate artificial gravity on a space ship, so rigid bodies on a ship could remain stationary or be moved naturally inside the ship, ignoring its orientation and velocity. I’ve tried parenting the rigid bodies to an empty GameObject (which I know is advised against), and I also wrote a script that applies the velocity of the ship to the rigid body, but this seems to be a little more complicated than it could be and also doesn’t work well with angular velocity.
My next idea is to simulate the physics on dummy game objects (basically just a GO with a collider and rigid body) at the world origin, and apply their calculated world position to the local positions of the objects (just a mesh) on the ships. I’m just concerned that with multiple ships in a scene, this will become very convoluted. It couldn’t be any more convoluted than writing my own physics engine though.
This idea isn’t exactly a requirement to build my game, I’m just experimenting with Unity and seeing what can be done. I just thought I’d ask if anyone had any input on the topic. Thanks in advance!