- Home /
Rigidbody.MovePosition relativeTo parent
Hello.
I have looked everywhere on google and though most of the questions are close, none of them address the problem I seem to be having.
2 quick bits of code.
pR = my rigidbody.
1)
movement = new Vector3(Input.GetAxisRaw("Horizontal"), 0.0f, Input.GetAxisRaw("Vertical"));
transform.Translate (speed * movement.normalized * Time.deltaTime, transform.parent);
2)
movement = new Vector3 (Input.GetAxisRaw ("Horizontal"), 0.0f, Input.GetAxisRaw ("Vertical"));
pR.MovePosition (transform.position + movement.normalized * speed * Time.deltaTime);
1 - Gives me the ability(at the end) to move relative to my parent's heading. Of-course this is best because my character is on a platform(its parent object) for most of the game. 2 - Unfortunately the example in (1) causes my player to bug out when the platform moves in the slightest, so I need to use rigidbody.moveposition to move my character. This is where i run into a problem.
How do i: Apply a "relativeTo" property to "rigidbody.MovePosition".
\
Thank you for reading,
Sincerely,
Bakos133
Your answer
Follow this Question
Related Questions
Rigidbody Sink into BoxColider 0 Answers
MovePosition not as precise as Translate with Kinematic rigidbodies (example unitypackage included) 1 Answer
How to give jump without rigidboy by using transform? 1 Answer
Move object upon hitting camera ray 1 Answer
Why is my Rigidbody child not moving with it's Rigidbody parent? 1 Answer