- Home /
Personal Gravity and Real Time Gravity Manipulation
I was wondering if Unity is suitable for building a FPS where characters are able to shift their centre of gravity onto other surfaces. Also possibly a weapon that might be able to manipulate this ( either causing zero g or making the target "fall" into the ceiling for example.)
there's absolutely no problem doing anything like this. Enjoy
Rochard was made with Unity. And it uses gravity and forces manipulation.
Answer by rutter · Jun 11, 2012 at 07:02 PM
There might be some sticking points, but I think they're more or less the same ones you'd run into anywhere else.
I'd probably start with something like this: turn off the physics engine's built-in gravity, and instead attach a custom component to each player and/or rigidbody in your scene that manipulates kinematics as if each object had its own local gravity.
The component is pretty simple: keep track of which direction is "down" and consistently call `AddForce()` in that direction with ForceMode.Acceleration
.
Answer by aldonaletto · Jun 12, 2012 at 12:00 PM
There are some problems:
1- You can't use the CharacterController easily, because it assumes that Y is the vertical direction. You can rotate the transform and manipulate the gravity (if you use Move, not SimpleMove), but the CC's capsule collider is always vertical. Maybe a spheric (height == diameter) capsule do the job, if it's acceptable in your case.
2- It's easier when using some rigidbody character - take a look at my answer in the question Walking on the walls - but you may run into the "South Pole Madness", a problem I had and could not solve yet: when the character gets fully upside down, it seems to become crazy, flipping between the desired and opposite directions at some points.