Jump to content
Leadwerks Community

Recommended Posts

Posted

Is it possible to use the controller for airplanes/spaceship. The idea is that the controller always moves in the camera direction. I see only

one angle i can provide to the controller and the only way i found is to add the height using the jump value. However in this case i would

need to calculate the whole movement by my own.

 

Is there someone who can provide a sample?

 

Thanks in advance

Posted

Short answer: no.

Long answer: I'm sure there's a way to hack it in but it will be really awkward. After all, they're called character controllers for a reason. :)

 

From the wiki:

 

Controllers are specialized bodies used to control the movement of liviing entities in the world. They allow you to move, strafe, sprint, jump, and lunge.

 

Why do you need to use a controller anyway? Can't you just use the body commands to achieve the behaviour you need?

 

Cheers!

Posted

Thanks for the quick response. So far the controller was an easy way to handle character movement and i was not aware that it is limited to character movement. I will have a look on the body command.

Posted

When you want to have an airplane/spaceship which is physically interactive you should have look at

CalcBodyVelocity() and SetBodyVelocity(). Same for CalcBodyOmega() and SetBodyOmega().

 

What i tried was:

 

Load a ship/airplane. (Ship)

 

Create a pivot. (Piv)

 

Every loop:

// Reset the pivot position
SetEntityMatrix(Piv, GetEntityMatrix(Ship));

 

//Move the pivot around (user input / AI) 
MoveEntity(Piv, SomeUserInputVector); 

 

// Calculate the ships velocity
TVec3 Vec3Velocity = CalcBodyVelocity (Ship, EntityPosition (Piv, 0), 1.0f);
SetBodyVelocity (Ship, Vec3Velocity, 0);

// Calculate the ships angular velocity
TVec3 Vec3Omega = CalcBodyOmega (Ship, EntityRotation (Piv, 0), 1.0f);
SetBodyOmega (Ship, Vec3Omega, 0);

 

 

That way any projectile hitting your ship will automatically affect it via physics (with zero programming) :)

(Win7 64bit) && (i7 3770K @ 3,5ghz) && (16gb DDR3 @ 1600mhz) && (Geforce660TI)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...