So I’m doing this “Interactive experience” thing as a project and all the animations are legacy because I’m using anim.Play(), was just wondering if i could scale/position objects without specifying the starting point? eg the user has 7 different positions, but once they hit a button no matter where they are they scale up to 1,1,1 and reposition to 0,0,0, without making 7 different animations because that is tedious.
Doesn’t have to use legacy animations as long as I can play it from a script, or maybe it is a script itself, not sure how it would work.
I’m very new to animating and programming for unity, so I am just using the built in animator and visual studio, sorry if I don’t understand a lot of it.
In this project there are 7 possible positions the player could be in, but once they hit a specific button, no matter where they are, they should move to 0 and their scale is set to 1. The current way I have it set up is with separate animation clips for every possible position, but is there a cleaner way to do this?
I mean, it really depends on your game, arent you controlling the movement and scale with a script, then just add +movement animation? Not sure why you would need 7 different animations for the same thing.
What is the code for controlling with a script?
The reason I have 7 different animations is because each movement is a premade one, and the animation clip is just moving the player from one position to another with 2 keyframes, it isn’t very practical tho.
Edit: I figured it out. For any other newbies like me, this is the code, using the first two lines for the scale and transform, and the last 2 for saving the position and returning to it later
transform.localScale = new Vector3(1, 1, 1);
transform.position = new Vector3(0, 0, 0);
yourGlobalVariableHere = transform.position;
transform.position = yourGlobalVariableHere;