- Home /
Question by
3r5k3n · Sep 01, 2013 at 03:53 PM ·
physicswheelcollidergroundvector3.angle
Get angle beetween surfaces
I've got the angle from my player relative to the surface using this code
var groundAngle:float;
var hit:WheelHit;
if(wCollider.GetGroundHit(hit))
{
groundAngle = Vector3.Angle(hit.normal,transform.up);
}
But how do I get the angle only in the local x axis. In other words I don't wanna know the grounds angle relative to the gameobjects z axis only in it's x axis
Comment
Answer by robertbu · Sep 16, 2013 at 10:40 PM
I'm not sure what you are going for here. Assuming you are looking for only the angle on the XY plane, you can do the following:
var v3 = hit.normal;
v3.z = 0;
groundAngle = Vector3.Angle(v3, transform.up);
Note that the angle is unsigned.
Your answer
Follow this Question
Related Questions
WheelCollider spontaneous jumping? 0 Answers
Wheel Colliders with addforce, not motorTorque. 0 Answers
WheelCollider slowing vehicle down at 0 torque 0 Answers