Question by
biancomatias8 · Mar 16, 2020 at 02:37 AM ·
2d game2d-platformer
2d character doesn't touch the ground and it is floating
yesterday I started using unity and I'm having a problem: I've already placed my character to move and jump on a platform, but then (at the time of playing) the character (the red square) doesn't touch the ground (the green square). any solution?
the scrip is:
public float movimiento = 2f;
public float fuerzaSalto = 3f;
public bool vivo = true;
void Start()
{
}
void Update()
{
if (Input.GetKey("a"))
{
transform.position += Vector3.left * movimiento * Time.deltaTime;
}
else if (Input.GetKey("d"))
{
transform.position += Vector3.right * movimiento * Time.deltaTime;
}
if (Input.GetKey("w"))
{
transform.position += Vector3.up * fuerzaSalto * Time.deltaTime;
}
}
whatsapp-image-2020-03-15-at-232926.jpeg
(100.8 kB)
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612225035im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
2D game character stands or sometimes block by an invisible object? 1 Answer
2D Dynamic Lights and Shadows 0 Answers
PlayerPrefs not resetting after death 1 Answer
Detect whether a Rigidbody collided with a Trigger 2 Answers
2D platformer: character getting stuck on side of 2d box colliders 1 Answer