Blender is a great way to put together a presentation, and I often manually navigate through the blender file to do a presentation. But for a more formal presentation, it would be good to move through it in a specific way and not have to worry about the precision of my manual navigation. Prezi already works like this, you tell it what you want to look at on each "slide", then it seamlessly transitions through the space.
I haven't seen a lot on this, so figured I would start a thread here to talk about it.
One way to do this is by moving the camera to certain spots in the scene. It is easy to then "jump" to different "slides", using the up and down arrow key which jumps to that spot on the timeline. If you are viewing the camera, it will then switch 'slides'. To get a transition, you could play the timeline, but you would need it to STOP on the next keyframe so you have time to talk about that 'slide' before moving on.
Perhaps there is an easy way to do this, but for now, the following python code is what I came up with. It just stops the animation playback if a camera keyframe is encountered. This seems to work, but I see some extra events in there so I worry it is going to bog something down.
import bpy
# Build a set of camera keyframe frames numbers
camera_obj = bpy.context.scene.camera
camera_keyframes = set()
for fcurve in camera_obj.animation_data.action.fcurves:
if fcurve.data_path.startswith("location") or fcurve.data_path.startswith("rotation_euler"):
for keyframe in fcurve.keyframe_points:
camera_keyframes.add(round(keyframe.co.x))
print("Set of Keyframe frames= " + str(camera_keyframes))
# Define the function to stop at camera keyframes
def stop_at_camera_keyframes(scene):
print("Current Frame= " + str(scene.frame_current))
if scene.frame_current in camera_keyframes:
print("At a keyframe in set, stopping.")
bpy.ops.screen.animation_cancel(restore_frame=False)
# Register the function as a handler for the "frame_change" event
bpy.app.handlers.frame_change_pre.append(stop_at_camera_keyframes)
print("Registered Function")
Related
I have the Player move around and when he enters a new Room (via Instancing) his Sprite shows him facing in the Default direction (in my Case down). So If you enter a Room from any other direction then it looks weird, cause for a short Moment you can see the Player facing down even if you came from the right. How can I tell Godot to set the Player Sprite to a specific Frame in Code, so I can set it to the proper Frame for each Direction. I'm new to Godot and I used HeartBeast Action RPG Tutorial for my Movement. So it's using an AnimationTree and AnimationPlayer. I tried "set_frame" but Godot just says it doesn't know the Method.
If you are following the tutorial series I think you are following (Godot Action RPG)… You are using an AnimationTree with AnimationNodeBlendSpace2D (BlendSpace2D).
The BlendSpace2D picks an animation based on an input vector "blend_position". This way you can use BlendSpace2D to pick an animation based on the direction of motion or the direction the player character is looking at. For example, you can "idle_up", "idle_down", "idle_left", and "idle_right" animations, and use BlendSpace2D to pick one in runtime based on a direction vector.
Thus, you need to set the "blend_position" of the BlendSpace2D like this:
animationTree.set("parameters/NameOfTheBlendSpàce2D/blend_position", vector)
Where:
animationTree is a variable set to the AnimationTree.
"NameOfTheBlendSpàce2D" is the name of the BlendSpace2D you want to set (e.g. "Idle").
vector is a Vector2D with the direction you want (e.g. Vector2.UP).
This is shown in the episode 6 of the tutorial series (Animation in all directions with an AnimationTree).
You can find a reference project by HeartBeast at arpg-reference, where you can find a function update_animation_blend_positions that looks like this:
func update_animation_blend_positions():
animationTree.set("parameters/Idle/blend_position", input_vector)
animationTree.set("parameters/Run/blend_position", input_vector)
animationTree.set("parameters/Attack/blend_position", input_vector)
animationTree.set("parameters/Roll/blend_position", input_vector)
Here "Idle", "Run", "Attack", and "Roll" are BlendSpace2D, each configured with animations for the corresponding actions, and this function updates them in sync so that they are picking the correct animation.
As far as I can tell the code from the repository is further refactored from what is show in the tutorial series. This code from the repository is under MIT licence.
so I'm making Emotes for my game and I need it so if the player moves at all it cancels the Animation and the Sound, does anyone know how to do this?
Here is my code in ThirdPersonCharacter for the emote:
I also need it so once the B key is pressed you can't press it again until you move. Without this you can spam the key and the sound goes crazy.
Thanks everyone!
P.S. The emote and sound loops, the sound is playing a cue
This can be done easily friend , you need to attach an audio component to your actor so that you have a reference to play it and stop it when your player starts to move or is standing idle, I recommend binding a function to where your player moves to stop the sound . The audio component has a stop function . You can also create a function to choose which sound should the audio component plays.
Now as for your second problem of sound going crazy a do once with delay node back to complete should do the trick , nonetheless there is also an input delay node which I forgot , YAAAAAAY time to learn new nodes!
I hope it helps . Keep on working :).
The issue here is that you're using the animations directly from the asset when, in fact, this is a perfect opportunity to use a Montage and blend the emote into the character.
If you detect movement input you can then cancel the whole thing. To stop the sound, you'll need to save a reference to the spawned SpawnSound2D in a variable. From there, a simple Stop node will do the trick. I'd probably leave the Montage running until it finishes to avoid unnatural character animations but if you truly need to stop the animation as well, use a Stop Anim Montage node
Be careful, though, sudden disruption of player feedback can feel clunky.
This answer provides a nice way to make smooth animations in SciLab. I now have to write a simulation of a body attached to two strings (and therefore its movement regarding some additional forces).
The code in the link works well to render movement of a single point and, unfortunately, I didn't manage to make an animation of a point + two lines using this method. If someone is curious, I tried this code to do it:
frametime=(tk-t0)/Nt//defining the waitnig time
plot(Y(1,1),Y(2,1),"o")//plotting the point
plot([0;Y(1,1)],[0;Y(2,1)],style=1)
plot([D;Y(1,1)],[0;Y(2,1)],style=1)//plotting the two initial lines
h1_compound = gce();
h_point=h1_compound.children
h_point.mark_size = 20;
h_point.mark_background = 2;
h_line1=h_compound.children
h_line2=h_compound.children
//h_axes = gca();
//h_axes.data_bounds = [0,-1;10,1];
realtimeinit(frametime);
for i=1:Nt//my vectors have Nt points
realtime(i);//wait "frametime" seconds before drawing the new position
h_point.data=[Y(1,i),Y(2,i)];
h_line1.data=[[0;Y(1,i)],[0;Y(2,i)]]
h_line2.data=[[D;Y(1,i)],[0;Y(2,i)]]
end
The question is: is there any way to make an animation of three shapes without making axes blink (as it is with the window refreshment) or other wierd stuff?
Since you didn't create a MCVE I can't reproduce your exact problem. But you may try to add drawlater(); before, and drawnow(); after your data modification to see if it does help with blinking or not.
Or you may get much better looking result by saving your plots in every round with xs2gif and assemble the animation with another gifmaker progam (there are free online sites to do this, however with some limitations). If you need to present your result, you should do this step anyway.
I have an Idle animation with arms holding a weapon which I have tweaked so It would work with a weapon I had created, I also have a running animation for the same arms which I need to tweak as well to work with my weapon, Is It possible to use the first keyframe from the Idle animation to offset the running animation's key to match it?
Ok so if anybody needs this in the future, I ended up using 3ds max's merge animation, it worked perfectly.
I've edited my previous answer to clearly state how this is done.
First, you want to export your idle animation. This can be done using the ATOM exporter in Maya or a third party plugin like PAIE or Studio Library. From here you can choose to only export the first frame or all frames. Make sure to select all the relevant controllers.
Secondly, you open up your running animation and select the same controllers as before, and then create a new animation layer with that selection. Animation layers are found in Channel Box / Layer Editor as a tab called Anim.
After setting up the layer, you can import your idle animation onto the layer. Again, this can be done using ATOM or a third party plug-in. Perhaps lock the BaseAnimation layer to prevent accidentally changing it. If you only wish to merge certain parts, like the arms, make sure to only export, import and add that animation to the animation layer.
I'm writing a video annotation application with Qt4 in which users need to be able to seek to various points in a video, putting markers on various objects and then setting keypoints for those markers so that they stay on the objects in the video as they move around. QGraphicsItemAnimation seems like a great place to start for these markers, however they need to be able to appear and disappear at specific times, which I can't figure out how to do with the QGraphicsItemAnimation. I could set the scale at 0 to make the objects disappear, but that seems like a pretty hacky solution, and I'm guessing that the paint engine would still waste cpu cycles trying to draw those invisible objects. Does anyone have a better solution than this? I'm using Qt 4.5.3 right now, but I'm willing to upgrade to 4.6 if it makes things easier. Thanks!!
It seems like the functionality you want of showing/hiding QGraphicsItem objects is beyond the scope of the simple "tweening" that the animation class performs. It is only for one object at a time, and any appearance or disappearance you have to write yourself.
You still might get some mileage out of QGraphicsItemAnimation (although the fact that it uses its own timer instead of being locked to the frame clock of your video is a little dodgy).
Neglecting "seeking" for a moment, there is a QTimeLine::finished() signal. If you let the end of an annotation's active animation timeline represent the point where you want it to disappear, you can trigger QGraphicsItem::hide() at that point. When it comes time to turn it back on, you would construct a new QGraphicsItemAnimation (based on the next run of keyframe data for that object) and call QGraphicsItem::show().
Note that one of the headlining features of Qt 4.6 is the QtAnimation framework, which is more sophisticated but also rather complex. I've not used it yet, but looking over the examples it seems like you might be able to "animate" a visibility or opacity property.