- Home /
Gravity issue, player movement!
Ok so, I have it when i press fire 1 the gravity flips and i go up to the ceiling. The problem is the head of my player is at the ceiling. I need to flip him around so he can walk on the ceiling. Here is the gravity script.
var speed = 10;
function Update ()
{
if(Input.GetButtonDown("Fire1"))
{
if(speed > 0)
{
Physics.gravity = Vector3(0, speed, 0);
speed = -10;
}
else
{
Physics.gravity = Vector3(0, speed, 0);
speed = 10;
}
}
}
Why not just make a quick little animation that flips him up and down.
how do i do that? I attempted that but it keeps repeating animation and i cant move my player after it.
Answer by Negagames · Apr 27, 2013 at 02:07 AM
When you flip directions, flip your player object 180 degrees (character controller and everything).
Agreed, make sure to flip THE WHOLE OBJECT. Also make sure your animation is not set to repeat.
Your answer
![](https://koobas.hobune.stream/wayback/20220613101049im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
How can i make artificial gravity for Kinematic Rigidbody? 3 Answers
Player lives script 1 Answer
A node in a childnode? 1 Answer
i have no clue what this means 1 Answer