4
$\begingroup$

Under certain conditions, I need my animation to be played. The rig gets a message every 5 tics and it seems that the animation is being played every 15-20 tics. My animation frame rate is 60, and same with the refresh rate. The player is in one scene, and the weapon is in another. I will not explain the "certain conditions" right here as it may be difficult; I will show you a .blend which is somewhat a replica of the functions that I have with this issue.

EDIT: I don't know how or even if this helps in any way, but if you have the animaion set to "loop end" instead of "play," the animation goes faster and slower randomly, sometimes it even stops! Just some more possibly useful or useless info: if I just do Always (freq. 0) > and > Play (0-5), the animation is still being played slowly, but if I do the exact same thing except I use "Loop End" rather than "Play," the animation seems to go the right speed. I am not saying I want to use "Loop End," I am just pointing this out if this helps. Thanks!

$\endgroup$
  • $\begingroup$ why don't you use play then? $\endgroup$ – Scalia Apr 10 '15 at 14:41
  • 3
    $\begingroup$ gosh, i'm severely confused... $\endgroup$ – Scalia Apr 10 '15 at 14:42
  • 1
    $\begingroup$ Don't worry 😊, I've been experimenting with your clever technique this whole time. I just want to conform that everything is under control. For the most part, you have the best answer so far. $\endgroup$ – blackhole Apr 13 '15 at 17:00
  • 2
    $\begingroup$ bounty ending tomorow, id say x-27 earned it. $\endgroup$ – Scalia Apr 13 '15 at 17:49
  • 1
    $\begingroup$ GAhh!!! only 22hours, you're gonna kill me with suspense! just get rid of it!!!! $\endgroup$ – Scalia Apr 14 '15 at 4:20
5
+50
$\begingroup$

Although no one can seem to find the problem you are having, There is a fail-proof method you can use here that skips the regard for frames and replaces them with logic ticks.

If you use this logic setup, The frame that CubeActon is on will always correspond to the integer property Frame. Clicking the mouse will set the Boolean property Play? to true. When Play? is true, the integer property Frame will increase by 1 every logic tick. When Frame is equal to 5, Frame will be assigned the value of 0 and Play? will be assigned false, upon clicking will start the process over again. enabling true level triggering on the left click mouse sensor on the object Cube will make it repeat the animation as soon as it ends. Effectively making it fully auto.

enter image description here

I don't expect anyone to actually try to replicate that, so just look at the blend and make use of

Ctrl+C and Ctrl+V

$\endgroup$
  • $\begingroup$ You are removing the idea of hold mouse1, and now you have to tap. If I had an extremely quick-shooting weapon, I don't think anyone would want to click very very fast. $\endgroup$ – blackhole Apr 11 '15 at 6:24
  • $\begingroup$ I have it plainly written how to make it fully auto. $\endgroup$ – X-27 Apr 11 '15 at 13:07
  • $\begingroup$ i.stack.imgur.com/d4hJs.png $\endgroup$ – X-27 Apr 11 '15 at 13:10
  • $\begingroup$ Ok, now it is full auto. Lets say our 'weapon' fires every 20 frames. You hold mouse1 and that works, but you can tap faster than holding mouse 1. $\endgroup$ – blackhole Apr 11 '15 at 18:46
  • $\begingroup$ No, using my exact setup, you can hammer on the mouse as fast as you want, but after the first time you click, no mater how much you click, the Boolean property Play? is already true and can't be assigned to true again until the animation loops through. $\endgroup$ – X-27 Apr 11 '15 at 19:29
6
$\begingroup$

The reason for this is that there is a big difference between frames and logic ticks. There is a default of 60 logic ticks per second, and 20 frames per second.

The current frame rate in your scene can be found here in case you accidentally changed it, but the default is 20.

enter image description here

If you add a delay sensor, and hover over the delay field, the tool tip that opens shows this:

enter image description here

The relation here is three logic ticks for every one frame. So for your mouse sensor, it should have the true level triggering set to 15 for 5 frames to play on your action actuator

You can avoid this by changing your mouse sensor's delay between positive pulses from 5 to 15

enter image description here

$\endgroup$
  • $\begingroup$ I am already using 60 fps, are you saying I should use a delay sensor? $\endgroup$ – blackhole Mar 26 '15 at 1:07
  • $\begingroup$ So you changed the Animation frame rate from 20 to 60? $\endgroup$ – X-27 Mar 26 '15 at 1:16
  • $\begingroup$ I already had it at 60. $\endgroup$ – blackhole Mar 26 '15 at 2:43
4
$\begingroup$

I compared the playback speed, in the viewport and in the BGE. I first used your very fast and short animation, then several different motions. The animation playback speed is the same for longer animations. However for your very short animation there is some times some delay. The difference appears to come from the way the BGE handles animations.
A simple fix is to simply make the animation longer. Here I duplicated your keyframes 7 times, for a total of 8 cycles in the one action (named move).
edited keyframes
Then increase the End Frame in the Action Actuator (more on the Action Actuator at the bottom of my answer).
logic bricks Action Actuator


Also the way you are creating the delay for the message could be made much better.

  • First note that the game property is now a Timer. It starts counting up from 0, in seconds, when the containing object gets added to the game (or in this case because the object is always there, when the game starts).
  • The True level triggering is not needed on either of the sensors (if left on it will automatically fire when the game first starts.)
  • The Property sensor's Evaluation type is set to Greater Than. If left to Equal you could only fire for the split second when the timer is at the value of the property sensor (if you missed it you could never fire again).

The logic bricks pictured below are only the ones used to create the delay and send the message.
logic bricks


The Action Actuator for your Armature.

On the Action Actuator for your Armature object in the Weapons scene, there is one little check box that can make a big difference.
Uncheck the Continue box on the Action Actuator.
Having that checked is telling blender to continue playing the animation from wherever it left off, you want it to always start at the beginning.

Action Actuator logic brick

$\endgroup$
  • $\begingroup$ Please re-read the question carefully. I bolded the main problem at the top. The problem is the extreme delay. $\endgroup$ – blackhole Apr 11 '15 at 0:52
  • $\begingroup$ @BlenderDev no matter how many time I read, and reread your question, with the file I download from your question I do not see the "extreme delay." $\endgroup$ – David Apr 11 '15 at 2:55
  • $\begingroup$ the best way to notice the error is the following: press play in the editor, and see how fast the anim. plays. Now, go in play mode, play the anim. there, and you see it is much slower. $\endgroup$ – blackhole Apr 11 '15 at 6:25
  • $\begingroup$ @BlenderDev see if my edited answer helps. $\endgroup$ – David Apr 14 '15 at 2:24
  • $\begingroup$ Provably wont, considering how much help the rest of the perfectly valid solutions here did... (IF you click once it will fire one bullet, but it will play the animation as if several were fired ) $\endgroup$ – X-27 Apr 14 '15 at 18:21
3
$\begingroup$

The reason this happens is cause the message actuator actually takes a tic to send. I don't know if this is on the sending end, the receiving end, or somewhere between, but Mike Pan wrote it, so it has to be true.

Also; I'm not quire sure what your question is

  • My animation plays to fast

  • My animation plays too slow

  • My animation Doesn't finish

  • My hair is falling out

So if you specify, I might be able to help better.

Current ideas for solutions:

Connect the logic straight into the armature, rather then sending a message. I know it's considered sloppy, but if it works, hey! who can blame you?

OR

Put all the logic on the armature rather than on the camera.<-- my pick !

$\endgroup$
  • $\begingroup$ He has the logic on one scene, and the armature on another, You can not have bricks connected between scenes. (At least I'd never try to because it is such a bad idea:-) $\endgroup$ – X-27 Apr 8 '15 at 18:26
  • $\begingroup$ Also, from looking at your demo file, I could not actually see the problem you are experiencing. $\endgroup$ – X-27 Apr 8 '15 at 18:40
  • $\begingroup$ same here.... maybe he is loosing his hair! $\endgroup$ – Scalia Apr 8 '15 at 19:22
  • $\begingroup$ @Vince Scalia "The rig gets a message every 5 tics and it seems that the animation is being played every 15-20 tics." How do you guys not see the problem? Just because my question is not 5 paragraphs long, it doesn't mean that it is not clear. And Vince, you asked what the question deals with. The quote says that the message is sent every 5 tics but only played every 15-20 tics, that means that the animation is slow. $\endgroup$ – blackhole Apr 8 '15 at 20:02
  • 1
    $\begingroup$ well it's not super clear. maybe a bug then? cause everything looks good to both me and @X-27. $\endgroup$ – Scalia Apr 8 '15 at 20:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.