Jump to content

how to control a plane


photo

Recommended Posts

Posted

I want to control a plane rely on physics, just like demo : portangles。

when i use c++ api: addTorque(vec3 , vec3) just like demo, the controled plane go round and round,the power on plane never be hypomotility。

The plane from portangles do not edit physics int Editor,just in sprict,but in c++, it not work。

What is the next Step?

 

Thanks a lot。

Posted
c++ code:
 
if (abs(current_rudder_pos) >= 0.1f)
   body->addTorque(vec3(0, 0, 0), normalize(side) *max(500.0f, min(1000.0f, 1000.0f * power))* -current_rudder_pos);
 
  if (abs(current_aileron_pos) >= 0.1f)
   body->addTorque(vec3(0, 0, 0), normalize(forward)* min(2000.0f, 2000.0f * power) * current_aileron_pos);
 
  if (abs(current_elevator_pos) >= 0.1f)
   body->addTorque(vec3(0, 0, 0), normalize(up) * min(1000.0f, 1000.0f * power) * current_elevator_pos);
 
 

×
×
  • Create New...