Reducing projectile's travelling distance
by Jason Wee · in Torque Developer Network · 01/18/2011 (10:49 am) · 7 replies
Hi everyone! I'm new here and in Torque Game Engine 1.5.2. Problem i've encountered is shown below.
I tried to reduce the crossbow's projectile travelling distance in "crossbow.cs" file, by adjusting its "lifetime" property value but it failed to work in a way, as the projectile does not seems to appear after afew seconds. This did not happen with the default value of "5000". I hope you guys can give me some advice on it. All help appreciated.
Just to let you guys know, the crossbow was taken from "starter.fps".
I tried to reduce the crossbow's projectile travelling distance in "crossbow.cs" file, by adjusting its "lifetime" property value but it failed to work in a way, as the projectile does not seems to appear after afew seconds. This did not happen with the default value of "5000". I hope you guys can give me some advice on it. All help appreciated.
Just to let you guys know, the crossbow was taken from "starter.fps".
About the author
#2
A value of 5000 is a very long time for a projectile to be in the air and depending on its velocity can clear the entire map before it expires which can be a waste of resources.
Also if you are turning down the lifetime you should adjust the fadeDelay as well.
01/19/2011 (9:24 am)
If you are trying to reduce the life of the projectile then you should try a value of 300 instead of 5000, you should notice the differance and then you can tweak from there.A value of 5000 is a very long time for a projectile to be in the air and depending on its velocity can clear the entire map before it expires which can be a waste of resources.
Also if you are turning down the lifetime you should adjust the fadeDelay as well.
#3
desired distance / projectile speed = lifetime in ms
For example: 500m / 100meters/sec = 5000 ms
This gives a projectile a traveling distance of 500 Torque units by limiting it's lifetime (5000ms) based on the velocity of the projectile (100m/s).
01/19/2011 (6:26 pm)
I use this formula when calculating my projectiles' lifetime:desired distance / projectile speed = lifetime in ms
For example: 500m / 100meters/sec = 5000 ms
This gives a projectile a traveling distance of 500 Torque units by limiting it's lifetime (5000ms) based on the velocity of the projectile (100m/s).
#4
01/22/2011 (12:26 am)
Michael Hall: how do you set the desired distance?
#5
01/22/2011 (1:01 am)
How far do you want it to travel? Just plug in the desired distance and velocity into the formula to determine the needed lifetime of the projectile based on how fast it travels. The combination of lifetime and velocity is what determines how far the projectile will travel.
#6
01/22/2011 (7:50 am)
Thank you Michael Hall! I will try that out. I have one more question, do you know how to create a "Character Selection Screen"?
#7
http://www.garagegames.com/community/resources/view/9339
04/28/2011 (5:46 am)
here is a resource for "Character Selection Screen", that I just found.. haven't tried it yet...http://www.garagegames.com/community/resources/view/9339
Torque 3D Owner Scooby Brown