Arrows movement
by Playware · in Torque Game Builder · 04/10/2007 (7:00 pm) · 6 replies
Hi,
i need to move some arrows that will move in arc. is there any way other than paths which i can achieve the effect??
i need to move some arrows that will move in arc. is there any way other than paths which i can achieve the effect??
About the author
#2
A fast way to get the arrow to point in the direction it's moving would be to set Forward Only as true. However, I'm not sure if this will work in conjunction with the gravity force. Using some trig functions in an onTimer callback would definitely work, but would take more time (and know-how).
Just throwing out some more ideas ;)
04/11/2007 (1:36 pm)
You may be able to achieve a quick solution by setting gravity on your arrow object then applying an initial force perhaps at a 45* angle.A fast way to get the arrow to point in the direction it's moving would be to set Forward Only as true. However, I'm not sure if this will work in conjunction with the gravity force. Using some trig functions in an onTimer callback would definitely work, but would take more time (and know-how).
Just throwing out some more ideas ;)
#3
04/11/2007 (11:24 pm)
Erm ok... i have figured out a way by simulating the physics in the scripts myself. first, i will shoot the arrows in the direction and force and after 1 sec, i will start decreasing the y-velocity by 10 every 0.1 sec (simulating gravity). just that i am not very sure if it is a good way to do it though it works reasonably well. somemore, i am also unsure if frame rates will affect it...
#4
04/12/2007 (12:01 am)
Ok, i have just tried another method involving forward movement only and it works better (at least the rotation looks more smooth). because my arrows only need to know the force and direction it should go, i am not so concerned about position.
#5
Greg
04/12/2007 (11:17 am)
I would let the gravity do the work as Kevin said instead of doing it yourself on a timer. It's almost comically easy with ConstantForce and it is certain to be less cpu intensive.Greg
#6
04/12/2007 (6:34 pm)
True, i intended to try a few more ways in order to nail down the final codes for this. i initially used path but i felt that it is too restricting, thus i decided to try another way. i did try using gravity but the arrows does not seem to return to correct angle of the direction it is going. My current way is to set forward movement and start rotating it to the estimated angle which it will be when it reaches ground. (e.g. 45 degrees starting, rotating to 160 degrees). It works well, just that how fast it falls will depend on its rotating speed.
Associate David Higgins
DPHCoders.com
I personally would invest some time in using the math functions and the vector manipulation functions ... paired with the moveTo and rotateTo functions ... determine all the points that the arrow would have to hit, then use the moveTo function and a callback to keep the arrow moving ... changing it's direction and speed as necessary along it's trip ...
I've not yet had to pull this off yet, so their may be some much easier and nicer ways to do it ... thats just an "off the top of my head" idea ...