GetMuzzlePoint during Animation
by Vinh Tran · in Torque Game Engine · 05/12/2005 (4:49 pm) · 4 replies
In my game I have a character and a mount0 point or node in the DTS model. In this game my character holds an object in his right hand. My game will be played from 3rd person point of view.
When the player holds the LM button, the character begins a throwing animation that brings his right hand across his body. When the player releases the LM button I want the game to throw the object in the character's hand from the point where his hand is at the time of release, in the current direction at the time of release.
I've tried getting the muzzlepoint of the weapon slot, however it never changes during the throw animation. I can understand this in First person view, but in third i'm actually animating the node and its moving around in space. Does anyone have an idea how I would accomplish this? How can I get the current location of a node or weapon slot while i'm animating that slot?
Thanks
When the player holds the LM button, the character begins a throwing animation that brings his right hand across his body. When the player releases the LM button I want the game to throw the object in the character's hand from the point where his hand is at the time of release, in the current direction at the time of release.
I've tried getting the muzzlepoint of the weapon slot, however it never changes during the throw animation. I can understand this in First person view, but in third i'm actually animating the node and its moving around in space. Does anyone have an idea how I would accomplish this? How can I get the current location of a node or weapon slot while i'm animating that slot?
Thanks
#2
%disc.isCharging = false;
%disc.isThrowing = true;
%obj.setActionThread("throw0");
%obj.schedule($SCHEDULE_THROW_TIME,"ThrowDisc",%disc);
%obj here is the player, %disc is the mounted image.
Perhaps i'm not animating the node on the server? I'm not sure what that means or how to do it exactly, if I'm not already.
The "ThrowDisc" function is being used to calculate a running total on the angle of the disc during the throw animation. Its in here that I check the value i get from getmuzzlepoint and see it never changes.
05/12/2005 (9:09 pm)
Under /server/scripts/player.cs on the Armor::onTrigger(...) function I'm checking to see if we are doing LM down. If we are then i do the following:%disc.isCharging = false;
%disc.isThrowing = true;
%obj.setActionThread("throw0");
%obj.schedule($SCHEDULE_THROW_TIME,"ThrowDisc",%disc);
%obj here is the player, %disc is the mounted image.
Perhaps i'm not animating the node on the server? I'm not sure what that means or how to do it exactly, if I'm not already.
The "ThrowDisc" function is being used to calculate a running total on the angle of the disc during the throw animation. Its in here that I check the value i get from getmuzzlepoint and see it never changes.
#3
If you are using "getMuzzlePoint" the angle is not provided, only the point in space (hence the name). Try:
05/13/2005 (6:15 am)
Vinh,If you are using "getMuzzlePoint" the angle is not provided, only the point in space (hence the name). Try:
%transform = %obj.getSlotTransform(%slot);Thanks
#4
I want to say i tried get slot transform before and the matrix that it returned never changed throughout the animation.
I know the angle isn't provided, i'm calculating it on my own just by adding numbers at each scheduled function call. I know that the entire animation represents 180degrees, so I just break up the length of the animation by the number of schedules and manually find the angle. I will be able to use this later, however I wanted to bypass this by just being able to find the point of the slot at any given time while its being animated and use that as my starting point for creating a projectile.
05/13/2005 (6:56 am)
It seems like that these muzzlepoint calls get the point or vector where the muzzle *should* be. I guess this is because of potential client lag? I noticed another function called getRenderMuzzlePoint (or something similar) that seemed to provide the actual world coordinates of the muzzle (wasn't a console command so i didn't test it with scripts). However, there was a note that these won't work on the server...I want to say i tried get slot transform before and the matrix that it returned never changed throughout the animation.
I know the angle isn't provided, i'm calculating it on my own just by adding numbers at each scheduled function call. I know that the entire animation represents 180degrees, so I just break up the length of the animation by the number of schedules and manually find the angle. I will be able to use this later, however I wanted to bypass this by just being able to find the point of the slot at any given time while its being animated and use that as my starting point for creating a projectile.
Associate Kyle Carter