|
What is the best way to determine if my target is standing upright after it has been hit with a physics force? I would like to be able to have a threshold value if the target is leaning. If it is leaning say 45 degrees or less, it is still considered upright. Thanks,
(comments are locked)
|
|
Don't use Euler angles for this. Instead, check the object's local 'up' vector to see how 'upright' it is. (An easy way to do this would be to compare the local up vector's 'y' value - assuming y is up - to some threshold value, e.g. .7. If you want to express the threshold in terms of an angle, you can compute the threshold for the y value from that angle using trig.) Thanks. I completely forgot about the transform.up for some reason. i'll put my code below.
Dec 06 '10 at 08:25 AM
BigToe
(comments are locked)
|
|
This is what I ended up using after Jesse reminded me of the transform.up vector.
(comments are locked)
|
|
Don't know if this is the correct way to do it, but it seems to work. Basically look at the eular angles. If the angle is greater than 45, then I considered the target knocked down.
I'm guessing there may be a more elegant way.
(comments are locked)
|
