Lock Rotation Degrees?

EatMoreHippo

  • Posts: 62
Is there a way to make it so that an actor will only rotate a maximum amount using the built in physics?

In this example I want a car driving along to never rotate more than -89 degrees (so the wheels are always facing the ground) even when hitting ramps and other actors that would normally flip it. Is this possible?

Miasmos Games

  • Posts: 878
Maybe let it rotate normally, but with a block of code that says something like "if direction is less than -89, point self towards -89 degrees" keep in mind though that this won't necessarily work full-proof unless you have some sort of code making it do the same for positive 89 degrees, and even then there might be problems. Does this work?

Cupcake Bounce

EatMoreHippo

  • Posts: 62
Maybe let it rotate normally, but with a block of code that says something like "if direction is less than -89, point self towards -89 degrees" keep in mind though that this won't necessarily work full-proof unless you have some sort of code making it do the same for positive 89 degrees, and even then there might be problems. Does this work?
This is exactly what I was looking for. Thank you for the help!

Miasmos Games

  • Posts: 878
Oh. Wow, that's good, I thought it wouldn't be ideal, but that's great :) Just post here or PM etc if you have any trouble with it, although hopefully it should work fine.

Cupcake Bounce

MerlinoDreamlab

  • *
  • Posts: 20
Thank you for the tip.
Just created and shared a behaviour called "Limit Rotation" search for it inside "StencylForge".

Attach to an actor and set the two properties Max and Min Degrees.

http://www.merlino-dreamlab.com
Apps for iOS, Android and Web. Game Art and Music.
The company's mantra is "Passion, Love and Creativity" developing apps that uplift, educate and inspire.