• 3D
  • Creating Perpendicular Vectors in 3d

Hello.<br><br>I have planetary gravity system and i want to make character stand correct on the ground, so what is the best way to create perpendicular vectors to correctly rotate the character?

<br>If anyone actually knows maths, please correct what I'm doing below if you see where I'm trying to go with this<br><br>Planetary gravity is basically having a actor .translate() to a fixed point in space, with a sphere blocking the actor from the point.<br><br><strike>I see in the rigid body class reference there is a set_axis_velocity() method. &nbsp;I am assuming you want to do something like <br><br>var chars_up_axis &nbsp;= Vector3(0,1,0)<br>var gravity = - 9.8<br><br>set_axis_velocity(chars_up_axis gravity)</strike><strike><br></strike><br><br>....<br>this math is a very poorly educated guess, but give it a try anyway<br><br><br>var a = actor.get_translation #(i.e. a vector3 of the actors position)<br>var b = planet.get_translation&nbsp;#(i.e. a vector3 of the point of gravity)<br><br>var theta = cosine(a.length b.length) #length of a vector is a float<br><br>var vect_from_one_to_other = vector3(0,theta*-1,0)<br><br>actor<br>actor.set_linear_Velocity(vect_from_one_to_other)<br><br><br><br><br>