Flipping Actor Mounts
by Sean Monahan · in Torque X 2D · 04/25/2009 (7:45 pm) · 3 replies
I'm having trouble flipping actor mounts. I have an actor with three mounts: a head, an arm and a gun. Each of these mounts has animations that are update when the actor moves, jumps, shoots, etc. The mounts are setup for 8-way aiming. The head and the gun actually rotate based on the aiming direction, and the arm's animation is updated to match this rotation (doing this for the arm produces a better effect than simply rotating the arm).
The problem I have is that when the actor moves left the mounts don't all flip to match the actor. Typically the head will flip no problem, and the gun and the arm will lag behind for about half a second and then flip. One thing I've noticed is that if I tap the left stick (I'm using a 360 control pad) for a split second -- doesn't matter how far, seems to be about the duration not distance -- I can get the actor to flip properly but the head, arm and gun stay facing the previous direction. There is absolutely no problem with flipping when the actor flips from left to right. This problem only rears it's head when flipping from right to left.
Here's a video that of this issue:
One thing I've noticed is that the flip seems to update when a new animation is played for the arm but even this takes about a half second (you can see this at about the :32 mark in the video).
I thought the fix in this thread resolved this issue for me, but it didn't work out.
Does anybody have any insight into this problem? Or a fix? Any input is very much appreciated. Thanks!
The problem I have is that when the actor moves left the mounts don't all flip to match the actor. Typically the head will flip no problem, and the gun and the arm will lag behind for about half a second and then flip. One thing I've noticed is that if I tap the left stick (I'm using a 360 control pad) for a split second -- doesn't matter how far, seems to be about the duration not distance -- I can get the actor to flip properly but the head, arm and gun stay facing the previous direction. There is absolutely no problem with flipping when the actor flips from left to right. This problem only rears it's head when flipping from right to left.
Here's a video that of this issue:
One thing I've noticed is that the flip seems to update when a new animation is played for the arm but even this takes about a half second (you can see this at about the :32 mark in the video).
I thought the fix in this thread resolved this issue for me, but it didn't work out.
Does anybody have any insight into this problem? Or a fix? Any input is very much appreciated. Thanks!
#2
The idle animation was originally just a single frame, but I changed it to be two frames from the same cell as suggested in the thread I linked to above. That, however, did not seem to really work.
I did notice however, that this was only happening when the mount animations were in the idle state so I reworked my idle animation to be identical to my run animation and the problem was solved.
Based on this it seems that not only does the mounted object need to be an animation with more than one frame but those frames also have to be from different cells in the sprite sheet. In the end I updated my sprite sheet such that I have two identical cells that I can use to create my idle animations and things appear to be working great so far.
04/28/2009 (12:03 am)
Okay, I think I have this worked out. The problem seems to be with my animations. Each of my mounts has three types of animations "run", "shoot" and "idle".The idle animation was originally just a single frame, but I changed it to be two frames from the same cell as suggested in the thread I linked to above. That, however, did not seem to really work.
I did notice however, that this was only happening when the mount animations were in the idle state so I reworked my idle animation to be identical to my run animation and the problem was solved.
Based on this it seems that not only does the mounted object need to be an animation with more than one frame but those frames also have to be from different cells in the sprite sheet. In the end I updated my sprite sheet such that I have two identical cells that I can use to create my idle animations and things appear to be working great so far.
#3
I'm curious what code (I'm working mostly in torque script) you are calling so when you flip your character the bullets know to fire in the flipped direction also.
Thanks for any help.
12/09/2009 (12:48 am)
Hi Sean, I just came across this thread and was wondering if you could help me out with a problem that you seem to have worked out. It might be super simple but I'm having a hard time getting my character to fire in the direction he is facing. I'm building something similar to your video and when I flip my character the bullets continue to fire in their original direction.I'm curious what code (I'm working mostly in torque script) you are calling so when you flip your character the bullets know to fire in the flipped direction also.
Thanks for any help.
Torque Owner Sean Monahan