Game Development Community

Rotating to a target

by Joe Banko · in Technical Issues · 03/13/2008 (11:29 pm) · 6 replies

I have a source and target object. At least one of them is moving. How do I get the angle to rotate my projectile from the source to aim at the target? I realize the target may have moved but that's kind of the idea. I don't want the target sitting still.

I could probably find this in the forums somewhere IF I WAS ALLOWED TO ACCESS THEM! Yes, I have purchased TGB and other products but when I do a search using the field at the top right I get a very nice list of possible answers. But when I click on them all I get is the page that says I haven't purchased a product. This is INCREDIBLY frustrating and one of the reasons I post as much as I do although I usually wait until I've banged my head on an issue for at least a couple of hours.


TIA,

Joe B

#1
03/14/2008 (7:27 am)
It appears that your account wasn't automatically flagged as having purchased any SDK products. You will need to get in touch with Garage Games to get that fixed.
#2
03/14/2008 (7:40 am)
Do you have access to some of the forum areas now?
#3
03/14/2008 (7:46 am)
Do you actually have the product for the forum you're finding the post in? I did a quick search for rotating to a target, I don't know what keywords you were using, and it got hits in the Torque SDK private forums, which you don't get access to if you only have TGB (which you clearly do as your post history has posts in the TGB private).

While your waiting for help from GG, I think I can help you here. I'm 99% certain there's a stock TGB behavior that does what you want. I don't have TGB installed on this computer so I can't verify it, but in a TGB project I was working on at one time we had this working.
#4
03/14/2008 (10:03 pm)
Scott,

If you know which one (behavior) it is I'd be glad to find out and since all of my objects (except the player) are generated programmatically I still need to find out how to assign behaviors that way. But I've done the back to high school thing and pulled out my trig books. Using a tangent calculation based on the positions and a couple of functions (mAbs and mRadToDeg) I can get pretty close to what I want by plugging values into rotateTo and setLinearVelocityPolar. I'll have to do some tweaking for when the target object passes thru the Y axis to get the correct rotation but at least I'm on the road.
As far as the help from GG, David Blake has been great but I still have the issue. Luckily members (like yourself) on the forum have been "nudging" me in the right direction to at least find a document that I can get to that has an answer. Of course with the progress I've been making I'll be purchasing the full TGE/TGB/TGEA suite of products fairly soon and hopefully the issue will be moot.......

Thanks again,

Joe B
#5
03/15/2008 (6:31 am)
Joe, the TGE reference has an AI function for directly targeting an object. There is a Tutorial also that uses it, Maybe it would help but it doesn't do physics, it just does a direct target.
The tutorial is Using Basic AI commands in the tutorial section under TDN and it means you need TGE to access it.
Just thought this might be a tiny nudge in the right direction.
#6
03/15/2008 (7:45 am)
Thanks Scott W. Before I heap TGE on the confusion stack I'm gonna dig myself a little more out of under TGB. I've been making a lot of headway to the point where I know more or less how to get to what I want and that'll probably help a lot when I take on TGE. For the time being playing with physics formulas is probably a good thing so my mind gets back into geometrical concepts and will give me a much stronger base to attack TGE from.
And the nudge is greatly appreciated.

Joe B