PlayMaker Help & Tips > PlayMaker Help

Rotation and Axis woes

(1/1)

Lane:
I can't figure out how to get the type of vector I want.

I have a hovercraft you can roll L/R, but I only want to allow x degrees of rotation either way before the automatic balancer kicks in and stops you.

The problem is that Get Rotation gives me positive from 0 to one direction and subtract from 360 in the other direction so I can't convert it to floats and setup triggers this way if I only want say 14 degrees and then it stops since the blending crosses the 0 value and moves to 359 since it is the actual degree value being reported.

I also don't see how to use Axis control for this, since the Axis will roll back to zero after releasing it so it isnt an absolute rotation limit since you could roll a lot, then press it again and go way past the intended limit, plus it's returned value is arbitrary and not in "degrees" (not that its a big issue, but harder to tune).

So how do I get the Rotation on the Z Axis to report its difference from 0 relative to world and use +/- values instead of the 360 degree method?

Attached is my experiment scene, its kind of sloppy but may help understand the problem, the terrain will probably be gone so you'll need a box floor with a collider.

A/D are roll left and right.

Lane:
Ok, there may be a better way to solve this buy I've done it by...

1) Get Rotation - store as TrueAngle
2) Mirror True angle into FixedAngle
3) If the value is greater or lesser than 180 it decides whether it is in the Lefting or Righting state.
4) When rolling right, the angle reports as 360 and goes down from there, so I subtract 360 from FixedAngle after it is cloned.
5) When rolling left, the angle reports as 0 and goes up, so I don't change the float.

That effectively makes left go grow into negative numbers from 0 and right grow as a positive number from 0 and I can use FixedAngle to reflect the effective rotation left/right and use it as a trigger to stop the players' input when it gets over x value.

Hope that makes sense.

Updated scene attached.

Navigation

[0] Message Index

Go to full version