Animation Scripting (382767)

I know that this may be a real noob question but I am more of a modeler and animator and this scripting is new to me so I just need a tip here utilizing a script I created an animation for my player object to move on a button press however how can I write the script so that it takes into account where the player is currently because when i created the animation I did so only translating one axis but it keeps moving the player back to the start point so how can I script so that a. it ignores the animations ideas on x and z coordinates or b. to calculate and keep the current axis wherever they may be and add them to the animation here is my current code

function update () {

if (Input.GetButtonDown(“Jump”)){

GetComponent(“Animation”);

animation.Play() ;

}

}

Thanks in advance for any help offered…I do like Unity

Art MMPLLC

Very sorry this second post was not me being impatient I think I accidentally hit the submit twice very sorry you can delete this one…

Art

Sorry I don’t have code to paste in, but the 3d platformer tutorial up here on the website includes animation code - I found it was a great place to start. Head over to the tutorials section and see if it helps.

If that doesn’t work for you, I think there’s still an animation tutorial here on Unity3d.com - maybe that’ll help :slight_smile:

Good luck!

Hi again!

I just re-read your post and realized my last answer wasn’t very helpful! …

I’m pretty sure that you will save yourself a lot of hard work by getting the animation ‘in-place’ rather than moving tbh. Especially for character animations.

Thanks,
Jeff.