- Home /
Move 2D ground up and down
How can i achieve to move the ground prefab up or down without making the car fall through?
(On the attached photo the ground it just a prefab with 2D Box and Rigidbody2D)
Car: Is it RigidBody? Is it affected by gravity? How do you move the car, through physics, position, or Translate()?
If it's affected by gravity, what happens if you just move the ground up? Newer versions of Unity are using pretty accurate physX and you have to move the ground verry fast, to make the ground Collider, miss the car.
Yeah it is affected by gravity as it's attached with rigidbody2d. The ground under the car is working just fine moving from the right to left but i want the car to be able to move up and down with the ground when the player swipes without falling through the ground colliders.
On the Car, go to it's RigidBody2D and set "Interpolate, from None, to Interpolate".
Then set "Collision Detection", from Discrete, to Continous.
Do the same for the ground.
Now you shoud be able to move the ground and the car shoud stay on it.
Answer by Some-Yahoo · Mar 10, 2016 at 09:15 AM
Don't move the ground, move the camera
As i mentioned i want to move the ground and the car up and down (vertically)