Question by
Veritas · Apr 14, 2017 at 01:17 AM ·
movementphysicscontroller
Adding proper air control to RigidbodyFirstPersonController
Unity's provided RigidbodyFirstPersonController moves like this:
if (m_RigidBody.velocity.sqrMagnitude < (movementSettings.CurrentTargetSpeed * movementSettings.CurrentTargetSpeed)) {
m_RigidBody.AddForce (desiredMove * SlopeMultiplier (), ForceMode.Impulse);
}
This means that if the body is moving at max speed (in air), you're unable to control yourself. I'd like to continue being able to control myself while still clamping the speed - How can I do this? I thought about checking the magnitude after adding a force, but I don't believe there's a way to do that in the same frame.
Comment
Best Answer
Answer by Veritas · Apr 14, 2017 at 02:33 AM
I was mostly able to solve it using this:
else if (!m_IsGrounded) {
Vector3 desVel = desiredMove;
desVel.y = m_RigidBody.velocity.y;
m_RigidBody.velocity = m_RigidBody.velocity.magnitude * desVel.normalized;
}
Your answer
Follow this Question
Related Questions
i need help in unity self balancing ragdoll 0 Answers
How can I fix my jumping script? 0 Answers
I can't move my player in a fps? 1 Answer
any tutorial for playercontroll, physics ? 0 Answers
Got unwanted motion blur on fast moving object (Only iOS) 0 Answers