- Home /
Question by
sethuraj · Feb 24, 2014 at 05:01 PM ·
collisionphysicsplayercharactercontroller
Keeping player stationary and let physics affect...
The scene is having a capsule with character controller with gravity applied using the following code.
Vector3 MoveDir=Vector3.zero;
float Gravity =10.0f;
void Update()
{
CharacterController controller = GetComponent<CharacterController>();
MoveDir.y-=Time.deltaTime*Gravity;
controller.Move(MoveDir * Time.deltaTime);
}
Below is the illustration.
The character controller is not moving.it stays at 0,0,0 with downward gravity.A ramp with mesh collider move towards this character controller and the ramp should slide under the character controller uplifting it smoothly.But its now working as I expected.
But this will work if I keep the ramp stationary and move the character controller towards to it using the MovDir vector.How can I do this...?Any help..?
cc_illu.jpg
(136.5 kB)
Comment