Intro to 3D Game Development

0 of 193 lessons complete (0%)

Scripting Part 2: Making Code Respond to Players

Copy the Starting Rotation

You don’t have access to this lesson
Please register or sign in to access the course content.

Just like we saved the starting height of the chest, we need the starting rotation of the chest lid. 

We could do this in three steps, by setting the x, y, and z values, or we could use the handy method copy, which sets all three based on the values in a different Euler.

Remember, this is the same as:

this.startingRotation.x = this.entity.localTransform.rotation.x
this.startingRotation.y = this.entity.localTransform.rotation.y
this.startingRotation.z = this.entity.localTransform.rotation.z