#what if i don t have a facingdirection
1 messages · Page 1 of 1 (latest)
just set it to transform.right or whatever
then it will always stay facing the same way as your object
but i don't transform.rotate my player
how is your player rotating?
i use animations to fake rotation
why?
its like a topdown thign
ah
then just make a variable and set it to your direction whenever you set your animation
Many ways to track direction. Best way to do that when you are directing animation, or animation itself can send events through animation actions on specific frame playing.
so maybe i could make a function that defines the direction the player is facing, and make a parameter that is passed through durign an animation event
oh but i can't pass a vector2 in an animation event
or just
Vector3 dir = facingLeft ? Vector3.left : vector3.right;```
what does that do?
picks left or right depending on which way you're facing
but wait
you're inverting the scale
so you can just use transform.right;
i also need it to work up and down
alright
so then
firepoint.position = transform.position + input
.position
wait
no
my brain is dying right now im so tired 😭
why would you set the position
wait what would i write
firepoint is a transform and input is a Vector2
if anyone sees this and feels liek suggesting something, please do, i greatly appreciate
i gotta go to sleep lol
thank you brother 🙏🏾
wait so if I want to make facingDirection = input
and i want to make firePoint = facingDirection
wouldn't the firePoint position always be (0,0)?
because input gets updated every frame
so if i stop moving input will = Vector.zero which will make the firepoint.right (0,0)
im honestly just super confused now
just dont run the code when input is zero
so that it stays in whatever direction it was before that
that is just the lastMoveDirection vecto2
*Vector2
so i used that
and now it's just rotating the firePint
wait
im dumb just a sec
ignore this
huh
ok so what's happening is that its rotating the firePoint but the position isn't changing at all
why do you need the position to change
i want to make it turn with the player right?
the fire point is a bit in front of the player
because thats where i want the projectiles to spawn
i don't want them to spawn on top of the player
how would i get the firePoint to be in front of the player?
would it be firePoint.right = lastMoveDirection + transform.position?
i figured it out