- Home /
Sliding/Moving Objects?
Heyy guys
I'm in need a little help, So I'm trying to make a game like 'Impossible Game' That was made on Ps3(That's all I know it from). But abit more advanced ( like more levels, different things etc.)
But I can't get the Cube to slide across the screen, It's only rotating.
He it is.
var speed = 100;
var jumpHeight = 8;
private var isFalling = false;
function Update ()
{
var rotation : float = Input.GetAxis("Horizontal") * speed;
rotation *= Time.deltaTime;
rigidbody.AddForce(Vector2.right * rotation);
if(Input.GetKeyDown(KeyCode.Space) && isFalling == false)
{
rigidbody.velocity.y = jumpHeight;
}
isFalling = true;
}
function OnCollisionStay()
{
isFalling = false;
}
try moving the map ins$$anonymous$$d of the player ill get some scripts if needed
function FixedUpdate ()
{
rigidbody.AddForce (10, 0, 0);
}
Answer by PvTGreg · Mar 05, 2014 at 07:36 AM
function FixedUpdate ()
{
rigidbody.AddForce (10, 0, 0);
}
try this im not sure if this applies constant force tho but you can check this out https://docs.unity3d.com/Documentation/Components/class-ConstantForce.html it definulty does
awesome! it feels good giving back to the community after all those questions i put up...
Your answer
![](https://koobas.hobune.stream/wayback/20220613135413im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Help In Making a SphereCast for 3D Tire! Working RayCast Script included! 0 Answers
UnityEngine.Input.GetMouseButton(1)) issue 1 Answer
I made a better shader how do i fix[add _Shadow Strength]help???>Sorry that im asking for to much 1 Answer
Mathf.SmoothStep not quite working. 1 Answer