- Home /
Simulating the Character Controller?
I'm attempting to create a game in the style of "Guns of Icarus", where players move around inside of various spacecraft, while engaging in multiplayer combat. I intend for the ships to have "Star Wars" gravity, where the players can move around, with a constant gravity source pulling them to the floor at all times.
However, as the Spacecraft are controlled by rigidbodies, I've been having difficulty finding a good mechanism for the player. When I attempt any character movement with rigidbodies, the ship is thrown wildly around due to the forces being applied from the inside.
The character controller, with it's lack of forces or mass, has proved to be the most promising, but as it is unable to rotate with the parent ship, it is unusable in this circumstance. Essentially I need a character controller, but one that will hold the rotation of the ship.
Does anyone know of a good way to simulate the character controller using another collider, such as the capsule collider, while still allowing rotation with a parent? I've been trying to figure this out for weeks, and have made little to no progress.
you could have the interior of the ship seperate from the exterior of the ship with interior rigidbody and colliders set to kinetic. ins$$anonymous$$d of parenting you would simply update the position and rotation to the exterior every frame. this would fix your problem of the ship bouncing around.
you can still have the player inside the ship on a seprate rigidbody as usuall. in your script whatever the ships velocity and rotation is just add it to the players current velocity every frame.
Use Rigidbody.$$anonymous$$ovePosition and Rigidbody.$$anonymous$$oveRotation!!
Any transform.Translate/Rotate will break your game Rigidbody physics