Why is gravity seemingly affected with this code/script?

Hi,

I would like to ask for any ideas or advice on the following.
I’ve made a parglider game, see sample video: [3dparaglider 2014 update - all levels quick test - YouTube][1]

With real paragliders if you pull both steering lines then the glider will stall/flair, and a cause a small forwards rotation.

At the moment I’m trying to get a stall flair added by script, see code:

function FixedUpdate () {
if(sisdown==1 && pitchk>=-4){pitchk=pitchk-0.1; transform.rotation=Quaternion.Euler(Vector3(pitchk,0,0));}
if(sisdown==0 && pitchk<=0){pitchk=pitchk+0.1; transform.rotation=Quaternion.Euler(Vector3(pitchk,0,0));}
}

Of course I have a fairly complex set of children objects and scripts attached to this paraglider object to control it, but the main part is that I have a hinge on the parent and I can control left or right with scripts and gravity etc etc :slight_smile:
Currently I am try to rotate the whole parent object at the stall/flair…

The code above actually works but if I let go of the S key gravity seems to go very high (something like value 844) and my paraglider gameobject goes up via Y axis very quickly… if I omit this code then my game works perfectly… why is gravity seemingly affected or the object going up quickly?

I realise that I might not be giving a lot of info but any pointers would be welcome.
Or am I approching the rotaion in the wrong way, should I try to add another sprung hinge in the X axis /foward direction, and add force to that?

There’s not much we can say about that. Fact is:

  • the rotation of a rigidbody has no influence on it’s linear velocity or the gravity it’s experiencing.
  • You said that the object goes up, so you probably are applying some upward forces to your RB. Gravity usually points downwards.

It’s most likely something in one of your other scripts. You might have a directed force applied in local space and when tilting your object the force points more upwards and accelerating it upwards. However that’s all just guessing as we don’t know anything about your project besides the information up there.