Move player from where they stand

Hello, I feel this question can be asked without showing my code. I just need my player(rigid body) to teleport( NOT SLIDE)
slightly to the right from where they stand on an action. For example if they press E → player teleports a foot to the right even if they’re not at origin.

2 Answers

2

What’s the problem, exactly?

You can teleport the rigidbody by just setting it’s position. rb.position += new Vector3(1f, 0f, 0f); would move it one unit to the right.

I don’t think there’s a direct set function in rigidbody, if you want to set position you simply use the transform component’s position and set it’s position to target Vector3.

https://docs.unity3d.com/ScriptReference/Rigidbody-position.html

–