Question by
Kderino · Aug 27, 2015 at 08:23 AM ·
rigidbodygravityplayer movement
Rigidbody player movement doesn't response to gravity
Im trying to code a player movement with a use of rigid body.
the movements seems fine but it looks like it doesn't use the default gravity anymore. and when i add force for jumping it doesn't response at all.
Here is the script:
Vector3 _direction = new Vector3 (Input.GetAxis ("LJoystickHorizontal"), 0, Input.GetAxis ("LJoystickVertical"));
rigidbody.velocity = _direction * _moveSpeed;
rigidbody.velocity = transform.TransformDirection (rigidbody.velocity);
gameObject.transform.position += Vector3.ClampMagnitude(rigidbody.velocity, _moveSpeed) * Time.deltaTime;
What I think is, it is because of the y-axis of _direction is set to 0.
I can't solve this one please help me.
Comment
Your answer
Follow this Question
Related Questions
Change player gravity by pressing a key? 1 Answer
How to fix / remove movement jitter from player? 0 Answers
Problem with gravity, OnCollisionEnter and OnCollisionExit 2 Answers
Dealing with mass tree spawning 0 Answers
Rigidbody Gravity Problem 0 Answers