Spaceship physics?
by Robert Norris · in Torque Game Engine · 08/09/2005 (2:22 am) · 3 replies
Hi,
i've searched garagegames for a resource about spaceship physic, but only found a forum-thread that i can't access.
I'm a real beginner in programming physics, so:
Has anyone a link to a resource or some codesnippets, to show me how to modify my flyingVehicle class and/or my scripts, so that the playermodel moves more like a spaceship?
best regards
rob
i've searched garagegames for a resource about spaceship physic, but only found a forum-thread that i can't access.
I'm a real beginner in programming physics, so:
Has anyone a link to a resource or some codesnippets, to show me how to modify my flyingVehicle class and/or my scripts, so that the playermodel moves more like a spaceship?
best regards
rob
About the author
#2
I would suggest you copy the flyingvehicle.cc and .h files into something like spacevehicle.cc and .h.
You will have to do a bit of search and replace to make this into a working class. ie replace all 'FlyingVehicle' instances with 'SpaceVehicle'.
The two main things to search for are 'gravity' and 'drag'.
The effects of gravity should be simple to remove at this stage as you will have a variable called 'sSpaceVehicleGravity' near the top of spacevehicle.cc which can be set to 0.
Removing drag is a little bit more work. You cannot set minDrag in the datablock to zero as this would cause a divide by zero exception in the preload function. If you do searches for 'drag' you will quickly see what needs changing, depending on your requirements.
You may also wish to remove the flight ceiling imposed in the updateMove() function.
Hope this helps.
08/09/2005 (8:03 pm)
It depends how much realism you are looking for. Most players aren't the keen on true newtonian physics and like to at least have drag.I would suggest you copy the flyingvehicle.cc and .h files into something like spacevehicle.cc and .h.
You will have to do a bit of search and replace to make this into a working class. ie replace all 'FlyingVehicle' instances with 'SpaceVehicle'.
The two main things to search for are 'gravity' and 'drag'.
The effects of gravity should be simple to remove at this stage as you will have a variable called 'sSpaceVehicleGravity' near the top of spacevehicle.cc which can be set to 0.
Removing drag is a little bit more work. You cannot set minDrag in the datablock to zero as this would cause a divide by zero exception in the preload function. If you do searches for 'drag' you will quickly see what needs changing, depending on your requirements.
You may also wish to remove the flight ceiling imposed in the updateMove() function.
Hope this helps.
#3
i must concede, that i don't want to implement true newtonian physics. But when the day comes, i will consult you, Ken :) This is my first project with Torque and i want to play around with some fast solutions.
So, i've found a lot of resources about setting gravity to zero and have done that already. I've integrated a physical zone for this behaviour, but the modification of my class would be a better place for that.
The hints about 'drag' and 'flight ceiling' are very helpful and i will check these out soon. I truely derived my own class from flyingVehicle and will also check the necessary replacements.
The main problem i have is: when i do a yaw movement, the playermodel seems to move around a fixed axis till it tumbles around in a small radius to this axis. I can't describe it in better way and hope you understand what i mean. This is the behaviour i want to change mainly.
Thanks again!
08/10/2005 (12:55 am)
Thanks for your replies!i must concede, that i don't want to implement true newtonian physics. But when the day comes, i will consult you, Ken :) This is my first project with Torque and i want to play around with some fast solutions.
So, i've found a lot of resources about setting gravity to zero and have done that already. I've integrated a physical zone for this behaviour, but the modification of my class would be a better place for that.
The hints about 'drag' and 'flight ceiling' are very helpful and i will check these out soon. I truely derived my own class from flyingVehicle and will also check the necessary replacements.
The main problem i have is: when i do a yaw movement, the playermodel seems to move around a fixed axis till it tumbles around in a small radius to this axis. I can't describe it in better way and hope you understand what i mean. This is the behaviour i want to change mainly.
Thanks again!
Torque Owner Brodycat
Ahhhh, pure science.