- Home /
Question by
andrea9671 · Jul 06, 2016 at 04:53 PM ·
unity 5physicsterrain2d game2d-physics
I have a problem with 2D terrain, help mee!
Hi guys, I'm a developer novice on unity, my problem concerns the movement of a player on a mobile ground. This is my test scene, only for test and resolv this problem.
The player for test is a pink sprite, with rigidbody, and the terrain is grass with rigidbody. The script of each block of terrai move it to the left with this istruction on Fixed Update:void FixedUpdate() { gameObject.GetComponent<Rigidbody2D>().velocity = (Vector2.left * speed); }This work great, but the player moves along the ground to the left, but I would like that the player would remain in his position. I do not want to remove the rigidbody on the terrain and on the player, and i do not want to use the "transform.Translate", because this instruction need to perform a recalculation of physical contact, and it makes the poorly performing program.
Do you have any idea to solve this without using freeze constraints? Thanks in advance :)
The rigidbody are all 2D
Comment
Your answer
Follow this Question
Related Questions
Gravity Direction Change 2D 1 Answer
Sprites not recognized as whole-spinning in different directions 0 Answers
To Use or Not to Use 3D Physics in 2D Game 1 Answer
2D game - Sprite deformation when add frce 2 Answers
Is there a standardized way for creating a 2D ball physics movement method? 0 Answers