#Getting Transform position synched within keyframe

1 messages · Page 1 of 1 (latest)

jaunty musk
#

Ok so i have a weird scenario.
longstory short, i have some 2d sprites with frames that animate as a rotation round the character grabbing things.

im using them to latch onto another gameobject as a grapple.
i've done the math to get the character to rotate around and stuff.

now what i have tried to do was set a local position that's moved in the animaton clip at certain keyframes, then i have the script to set these movements onto the main transform in update/fixedupdate.

while it sorta worked, unfortunately it doesn't stay completely synched and just slightly jitters a tiny delay between the sprite frame and the set position.

i want to set an animation event that doesn't directly change the transform because i got some custom physics moving. but i just wanna offset the sprites a bit

weary phoenix
#

Probably some video of the problem, but otherwise if you do have some physics fighting against the animator, yeah it's going to jiggle.

#

So ideally you're turning off those controller if you want the timeline to take control of them

jaunty musk
#

yeah i'd show a video of what im trying to do, but since it's a fangame and i dont know how the community feels about me posting even if it's just to learn.

#

but yeah, im considering turning off the animator controller or finding a way to coroutine the animation playing to help control the movement

jaunty musk
#

i think what i'll resort to do is make a coroutine and make sure the animation frames move forward the sametime i offset the position.

jaunty musk
#

alrighty so i got a new idea.
find a way to temporary disable unity's animator or at least prevent it from keeping me from changing sprites?
create my own cheap animator that allows me to set the sprite and adjust the controller's position within the script.

#

i like unity's animator, but with the really weird scenario i have, i can't keep my sprite and position 100% synced along my lerps/sines.

#

so assuming i can just coroutine i want the animation to do and loop it while only ont he particular path, should give me the result i want

#

on another subject, can i check the sprite in the same update frame and if it's different from previous, can't i just update the position then?

#

i'll try that first since that sounds less complicated

jaunty musk
#

actually... perhaps i can disable the animator component

#

then modify the sprite and position that way

#

otherwise i'd have to resport to jsut changing the sprite's pivot for that animation... but then that means having to sort out the hitboxes if i want things to stay making sense

#

OK so yeah, finally a solution that doesnt involve changing the sprite

#

disable the animation component temporarily and animate the frames manually

jaunty musk
#

Ok i ended up with a new better idea

#

instead of disabling the animation component (which would have worked)

#

i decided to lerp a floor to int an array of frames to adjust for the particular animation. placed it into the update to make sure it all stays synced