Expression2 Help Request: Rotating an entity on one axis

Expression2 Help Request: Rotating an entity on one axis - Little girl doing housework in room

I've been looking and trying to learn for about the last 3 hours and I cant get my head round how to achieve this.

I'm trying to use an entity marker attached to a prop, then use E2 to spin the prop on a set axis. E.g spin the chosen entity on the Y axis at a set speed.

How can I achieve this?



Best Answer

Depending on the server's setup you can put the E2 directly on it and do the following:

@persist Prop:entity
if (first())
{
    # lines starting with # are comments in E2
    Prop = entity():isWeldedTo()
    Speed = 10 #10 units every 100ms
}
interval(100) #how long to wait until we execute again, 
# could use runOnTick(1) for every server frame

#this sets Prop (in this case welded to the E2, you can have this instead:
#@input Prop:entity
Prop:setAng(ang(Pitch, Yaw, Roll))

#here's where you change what you want to rotate on:
#you can put Pitch, Yaw, or Roll

#remember: pitch is up and down, yaw left and right, and roll is top to left / top to 
#          right
Yaw += Speed



Pictures about "Expression2 Help Request: Rotating an entity on one axis"

Expression2 Help Request: Rotating an entity on one axis - Happy Asian woman showing like gesture while granddaughter organizing clothes on hanger at home
Expression2 Help Request: Rotating an entity on one axis - A Man Seeing Counselor
Expression2 Help Request: Rotating an entity on one axis - Man's Hand in Shallow Focus and Grayscale Photography





How to Rotate on only one Axis || Request || UE4 TUTORIAL




Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Alex Green, Alex Green, Tima Miroshnichenko, lalesh aldarwish