- Home /
Question by
Dracofalcon · Jan 12, 2013 at 05:04 AM ·
gravityplayer movementspace
Unity Space Gravity
Ive created a code to attach to rigidbody objects and the player to disable gravity when they enter a collide area with IsTrigger marked, When i go to test it gravity remains the same the code for the player is
function OnTriggerEnter (other : Collider) {
if (other.CharacterController) {
other.CharacterController.useGravity = false;
}
}
and the code to attach to the collider that is space is
function OnTriggerEnter (other : Collider) {
if (other.attachedRigidbody) {
other.attachedRigidbody.useGravity = false;
}
if (other.CharacterController) {
other.CharacterController.useGravity = false;
}
}
Your help would be greatly appreciated.
Comment
Format the code.
WritingLi$$anonymous$$eThis{is()nreada|}le
Your answer
Follow this Question
Related Questions
Adding a force(gravity) to a planet. 0 Answers
Rigidbody gravity between planets 1 Answer
Newtonian physics in a space game 1 Answer
Space Game (Noob Movement Question) 0 Answers