#oh sorry that should be

1 messages · Page 1 of 1 (latest)

dense niche
#

transform.rotation.y is not a meaningful value. It is the second component of a Quaternion.

#

you can get the Euler angles from the rotation, although manipulating Euler angles can still be error-prone

tall sleet
#

@cold otter It would help if you described what you want to achieve with this one-axis rotation functionality

cold otter
#

with transform.lookat it also just turns the whole enemy toward the player at all times and it looks weird asf

tall sleet
#

So you want to rotate on the Y axis only?

#

a.k.a. horizontally, from side to side?

cold otter
#

yeah

#

left and right

tall sleet
#

var lookPos = player.transform.position;
// Align the lookPos vertically to our own position so we dont look up and down
lookPos.y = transform.position.y;
transform.LookAt(lookPos);```
#

That should be all you need

cold otter
#

ok

dense niche
#

yep, that sounds reasonable.

cold otter
#

ok so i forgot to lock the x and z rotation of the rigidbody and its really funny

#

if i knock over the enemy it just ceases to do anything

#

it just gives up completely

tall sleet
#

Sounds like a feature

cold otter
#

ehhh

#

might make it a feature later in development for a special enemy type or something

#

like the 2018 ultrakill marksman