tkunze Posted August 29, 2010 Share Posted August 29, 2010 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 Quote Link to comment Share on other sites More sharing options...
Laurens Posted August 29, 2010 Share Posted August 29, 2010 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! Quote Link to comment Share on other sites More sharing options...
tkunze Posted August 29, 2010 Author Share Posted August 29, 2010 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. Quote Link to comment Share on other sites More sharing options...
DaDonik Posted August 29, 2010 Share Posted August 29, 2010 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) Quote (Win7 64bit) && (i7 3770K @ 3,5ghz) && (16gb DDR3 @ 1600mhz) && (Geforce660TI) Link to comment Share on other sites More sharing options...
tkunze Posted August 29, 2010 Author Share Posted August 29, 2010 Thanks a lot. This is exactly what i was looking for. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.