- Home /
Question by
ChupoX · Nov 15, 2012 at 08:50 PM ·
javascriptrigidbodycharacter controllerpushing
Character Controller pushing other rigidbodies
Hey, I have a current script which makes Character Controller be able to push other rigidbodies, but I have a problem. When there is a descending slope on the terrain, my character can't push the object in that (descending slope) direction. The object just stops and it seems like it's lagging. Help me please, and tell me why is this happening. Thanks alot!
Here's the script:
var pushPower = 2.0;
function OnControllerColliderHit (hit : ControllerColliderHit) { var body : Rigidbody = hit.collider.attachedRigidbody;
if (body == null || body.isKinematic) { return; }
if (hit.moveDirection.y < -0.3) { return; }
var pushDir = Vector3 (hit.moveDirection.x, 0, hit.moveDirection.z);
body.velocity = pushDir * pushPower;
}
Comment
Your answer
Follow this Question
Related Questions
Collsion without ririgibody 1 Answer
Ethereal Character Controller 2 Answers
Ragdoll driven game 1 Answer
Cannot register Collision from behind. 0 Answers
Stop objects from going through each other with rigidbodies 1 Answer