Programming actor rotation into controls

sinbotsinbot Member Posts: 232

I have an actor without fixed rotation, so it can fall over. I want to make the controls stop working if the actor rotates to a certain point, in both right or left directions. This will allow the actor to fall over once beyond a reasonable point of recovery.

I know what angles I want as a limit to this rule (120° and 50°), but how do I program that? Would appreciate an example or two of how you might work that logic in!

Comments

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 3,170

    Have a game level boolean attribute called something like "tipped"

    In actor, constrain attribute tipped to = actor.angle < minAngle or > actor.angle

    Wrap all controls to work on tipped = false.

    If it's more natural for your logic you could inert it and call the attribute "upright" and control only when upright is true.

  • sinbotsinbot Member Posts: 232

    Thank you. The only thing is I'm not sure what to put in the expression editor. I only see rotation as an option under the actor. I can't find any "angle" selection.

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 3,170

    Sorry, I meant rotation.

Sign In or Register to comment.