Game Development Community

Newbie question

by Tim Mosier · in Torque Game Engine · 06/19/2008 (3:35 pm) · 3 replies

Alright, heres what I want to do. I have a custom character and all the animations for a platform shooter. What I want to do is have the characters arm point in the direction of the mouse. And an object that is the players gun arm, linked to the body, to pivot up and down at the angle of the pivot point on the body and the mouse; and the bullets to travel along the same linear path. I realize this is going to be quite a task, but let me know where is best to begin.

About the author


#1
06/19/2008 (4:19 pm)
Well first thing is first, you should should create a mouse targeting system. i believe that you could find a tutorial somewhere on the forums. Once you have a mouse targeting system, you would need to rewrite your animations to follow the mouse, ala blended animations, i believe is what they are called.. then tie the two together, as logic dictates, your gun will follow the direction of the hand, which is following the mouse targeting. correct? If i understand what your trying to do. I recommend possibly using AFX as it already has a mouse cursor system with point and click targeting in place.
#2
06/19/2008 (6:06 pm)
By blended animations do you mean something like transition animations between varying angles that are called by reference with the mouse targeting system? Basically a frame for each angle or each couple angles? I was hoping there was some way to literally rotate the object around a specific point and that angle would be references to the bullet's direction as well. I was curious about math functions in Torque as well. My first thought was that I could determine an angle by something like angle = atan((mouse.y - player.y)/(mouse.x - player.x))... Then I figured if I wanted my bullet speed to be say 300, I could just do somethign like linearVelocityX(sin(angle)*300) and linearVelocityY(cos(angle)*300) and such. even if I had to use something more complex like rotation matrices even. I am fairly new to coding, just started school for game and simulation programming where we use Torque.


Also, I have been searching the forums for information on a mouse targeting system but havn't found any. If anone can remember specifically where, and give me direction, it would be much appreciated.
#3
06/19/2008 (6:31 pm)
www.garagegames.com/products/102/
The AFX system has a mouse/cursor targeting system.

Quote

Powerful Constraint System

Independently constrain the position and orientation of any effect to other scene objects such as a spellcaster, a target, a projectile, or the camera. You can even attach effects to animated nodes of an object, such as a character's hand. Create complex tracking effects using constraint history.

End Qoute

The only obstacle you will have is tying your animation to the mouse curse. Which Determinance (another torque based game) did very well. As i am not a programmer i wouldnt have a clue how todo it, but it gives some leads of practicle examples. You might be better talking to a programmer or having them setting up your system, though you need to get some models done to do what you are asking. You dont need to worry about bullet speed (unless thats a specific point of your game) as the bullet trail will follow from your gun, which will be matched by your animation/targeting setup. If i understand you and what your asking.