Game Development Community

Rotation, conform to normal, turrets

by Michael Cozzolino · in Torque Game Engine · 08/03/2005 (8:18 am) · 3 replies

Ok I'm trying to get turrets to deploy and conform to the surface its on. I was able to do that with the postings of Martin Hoover www.garagegames.com/mg/forums/result.thread.php?qt=24646

Problem is i'm trying to get the turret to be pointing the correct way. Ala Tribes or Tribes 2.

I found this in the T2 deployables code.

%deplObj.setDeployRotation(%item.surfacePt, %item.surfaceNrm);

Looks like it takes the position and the surface normal and does something with them to get the correct rotation.

Here is some test data though using echo's in T2:

Pos = "-265.736 -57.9039 167.263";

Normal = "0.659061 -0.60468 -0.447214"

Rotation ends up being.

"0.894705 0.367466 0.253913 234.888"

I am probably the worst person in the world to come to with a math question. I literally start getting a blank stare on my face. I'm hoping that someone could help me figure out what that function is doing mathematically. Since it no longer seems to be a Torque Function. An example with Torque script / pseudo code would be much appreciated.

About the author

Indie Developer in the Albany NY area. iOS, PC, Mac OSX development. http://itunes.apple.com/us/artist/michael-cozzolino/id367780489


#1
08/03/2005 (8:45 am)
Michael,

One problem is that the Tribes 2 turrets are not the same as torque turrets. Toruqe turrets were written from scratch with no attempt to make them exactly compatible with tribes. Blame me for that...I made them and had no familiarity with Tribes turrets.

I am not sure I understand the question.

If the turret is deployed conformed to the terrain then you shd be done.

There should not be any special "rotation" to the turret itself.

the turret shd continue to fire accurately with ONE caveat.

as stated in the turret source...the BALLISTIC FIRING will NOT work for AIturrets whose local Z does not align with the world Z. If you conform to terrain thats not horizontal then the AIturret will NOT aim accurately when armed with ballistic projectiles.

Maybe you could explain more what needs to happen AFTER the turret is correctly conformed to the terrain? Or is the problem GETTING it conformed?


Edited [spelling]
#2
08/03/2005 (8:56 am)
Hi thanks Paul. I realize that your turrets are probably different from the T2 turrets. I don't think my problem would be the result of that but i'll try to explain in more detail. Here is a screenshot.

img17.imageshack.us/img17/6727/base000000097pn.jpg

The dif that the turret is deployed on in the above screen is angled about 35 to 40 deg. From left to right of the players pov.

In the case of deploying on a wall I would like to have the turret point either straight up or down. On ceiling or floor I would like the turret to point in the direction the player is facing.

Does that make sense?
#3
08/03/2005 (9:12 am)
Quote:as stated in the turret source...the BALLISTIC FIRING will NOT work for AIturrets whose local Z does not align with the world Z. If you conform to terrain thats not horizontal then the AIturret will NOT aim accurately when armed with ballistic projectiles.

Interesting. I believe one of our source guys is modifying the turret code so hopefully he realizes that. :)