Hi . I am trying to make a vehicle and that is if a car is on side or upside down it will respawn . But I try make this work, but it not .
if car.Orientation.X < 90 or car.Orientation.X > -90 or car.Orientation.Z < 90 or car.Orientation.Z > -90 then
end
I look on forums and nothing and I tried doing that , but it didn’t work
You could try something like
if car.CFrame.UpVector:Dot(Vector3.yAxis) < 0 then
-- Car is upside down
end
The Dot product basically just checks how much of the first vector (in this case the car’s UpVector) is in the same direction as the yAxis Vector3 (0, 1, 0). When they are both remotely in the same direction (i.e. when the vehicle is upright) the value is more than 0. When the car is sideways, the value is 0, and when the car is upside down, the value is less than 0.
1 Like