I’ve searched for this answer for 2 days and I’m stuck.So,I have an actor who gets spawned at a certain AnimNotify event,In actor’s blueprint I have a custom event who drives the logic.It fires a line trace and I want to interpolate actor’s position from start of the trace to the end,or if it hits,to hit point.How can I do this without tick? I’ve tried with Timelines,by multiplying timeline with the difference between start and end points but then the speed would vary by distance(ie. the closer the hit point , the speed gets lower).Now I try the vInterp node,but it needs a tick…What is the solution to this!?
Without tick
Interpolation works by sampling previous results: no previous result = no next result. If you do not need this updated every frame, you could use a timer and update it less frequently. Or lower the Tick rate.
I’ve tried with Timelines,by multiplying timeline with the difference between start and end points but then the speed would vary by distance
If you want this time based, you can adjust the timeline’s play rate.
Here’s what I mean:
The only variable here is the distance (displayed) to travel. They move with the same speed, it just takes longer to move further.
Thank you very much @Everynone ! That clears some of my questions about maintaining the speed.
Anyway,now that I think about it,I think i actually need it to update every frame,since this object act as a projectile in my game.But how can I implement tick if I already have a custom event?I just need tick for updating position.I’ve tried to use tick before but,as tick refreshes every frame, until my actor gets to end point it already shoots a new trace so it keeps looping forever.I attached a blueprint with my setup so far.
Maybe you do not need tick or timeline at all. Maybe you need a projectile movement component. The component ticks internally, calculates stuff and moves the root of an actor every frame (even between frames!). Think of pushing something in a direction with X speed and it just keeps going. The control parameters are quite granular and allow for a lot of flexibility.
I wish I understood more about the movement implementation you need.
- you could add offset with Sweep
- you could use a pawn instead of actor and add input vector every frame
Hard to tell what is best without fully understanding what you’ve envisioned.
Or perhaps you can use Interp To Constant:
This will move during tick with Constant speed until Target is reached.
I just need tick for updating position.I’ve tried to use tick before but,as tick refreshes every frame, until my actor gets to end point it already shoots a new trace so it keeps looping forever.
Trace once, set up the desired data and open the gate.
Well,I’ve tried to filter to a Gate node,but still to no result.I think I’m doing something very wrong
Here is my updated Bp:
And how it looks in game,no movement whatsoever…:
2022-02-15 21-43-25.mkv (2.4 MB)
Nah, that would not work well.
- you can’t guarantee those trace result to be valid all the time
- the static mesh is local to this actor and we’re updating it’s world location?
The last bit is a tad odd but can be ignored for now - who knows what uncanny things you’re up to!
It would be closer to:
The trace start / end would work fine for a timeline but not for interpolation. We need previous results - we’re calculating the location of the mesh based on its previous location last frame, not where it had originally started.
Btw, there’s also this thing that I never mention because I hate it so very much:
No regular tick. Just component (tick) magic. You punch in some control points and it will move stuff between them - but it’s more suited to moving actors, components would be awkward. It’s like a timeline but you get to control virtually nothing.
I like the idea of using Set Timer by Event node instead of using event tick. You can control the updating rate and can improve performance
It worked! Thank you very much guys!
One last question: why you say it’s not ok to update world location?Should I work with relative location?
I only said it because I do not fully understand the dependencies in your scene. It might as well be the best way to go about it (especially when it works!)
Generally speaking, once a component is a part of another blueprint, most of the time, you would be interested in the relative space; not always, though. Here’s me using a component’s world space this morn, because it made sense in this very instance:
Hello,
I’m doing a bit of necroposting but what you shared is very close to what I want to achieve: replacing “Rinterp To” to get a smooth and constant rotation (I tried “Rinterp To Constant”, but its behavior is not what I look for (it does Y then Z, no diagonales)).
I’m doing Y and Z rotations starting from the World Rotation of a component and applying the rotation coming out from “Rotation from X Vector” pointing in the direction I want the thing to reorient.
I’m struggling with the rate calculation with angles/rotations if someone could provide some help
Thanks in advance!