Hi! My goal is to create a planet that revolves around a star, and allow players to wander around on the planet, drive cars, etc, while it moves. I already have this working successfully by attaching the planet to a node in the center of the star, then rotating the planet node and star node independently to create both the motion of the planet rotating on its axis as well as the planet revolving around the star, and I use quaternions to rotate the player, and they do stay on the planet while it rotates and such. The problem is that it is very unstable with physics involved. Players can easily walk through objects, when they are falling it is jittery, etc. A while ago I created a topic about keeping the player on the planet and “zarch” said “…I think the solution would be to set up a physics space for the planet and have it effectively stationary.” Here’s the post. I am still using BetterCharacterControl.
Basically what I want to do is just what zarch said, create a PhysicsSpace and attach it to the planet while it rotates, that way I won’t need to update the players’ positions and such, only the PhysicsSpace. The problem is moving the PhysicsSpace. I don’t know how to do this, or if it is even possible. Does anyone know?
Its actually pretty easy, you just make multiple physics app states and set the physics control to setApplyPhysicsLocal, then you attach the respective spatials all to one node and treat it as the local physics system, i.e. the planet.
This should add the player’s node to the planet’s node, as well as add the player to the bulletAppState assigned to the planet. When the planet rotates, though, the player doesn’t move with it. I know I left out a lot of code, if I need to post more let me know, feel free to ask me all kinds of questions, I really don’t know where to go with this