Jump to content

Translate 90 degrees on activate


antstubell

Recommended Posts

I've been toying with this idea for some time so I'll give it a go.

Objective is that an object rotates + or - 90 degrees on each activation. Effectively player can completely and indefinitely rotate an object.

Here's what I have so far.

 

Float Property RotationVal Auto
Float Property SpeedVal Auto
ObjectReference Property TranslateRef Auto

Event OnActivate(ObjectReference akActionRef)

Float CurrentPosX = TranslateRef.GetPositionX(); get position X
Float CurrentPosY = TranslateRef.GetPositionY(); get position Y
Float CurrentPosZ = TranslateRef.GetPositionZ(); get position Z
Float CurrentRotY = TranslateRef.GetAngleY(); get rotate X angle
Float CurrentRotY = TranslateRef.GetAngleY(); get rotate Y angle
Float CurrentRotZ = TranslateRef.GetAngleZ(); get rotate Z angle

; If condition checking on whether player chose rotate left or right
; For this example, assume player chose rotate right = + 90 degrees added to RotZ value

TranslateRef.TranslateTo(PosX, PosY, PosZ, RotX, RotY, RotZ, SpeedVal, RotationVal)

; EndIf

EndEvent

 

The line which translates requires a bit of formula so I am guessing that -

 

TranslateRef.TranslateTo(PosX, PosY, PosZ, RotX, RotY, RotZ + 90, SpeedVal, RotationVal)

isn't correct.

Another concern just popped into mind. How to tell script that +/- 359 degrees is the max. rotation and after that reset to 0

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...