First of all, Why do I have to Inverse the CFrame I know that the offset will be like this:
Suppose,
A = car.Chassis.CFrame
and -A = car.Chassis.CFrame:inverse()
B = thruster.CFrame
if I do the offset thing,Then It will be like: " - A + B or B - A "
*** But I didn’t understand why I have to do the offset.And If anyone can explain this code, It will help me , thank you.!
-- Wheel turning
local offset = car.Chassis.CFrame:inverse() * thruster.CFrame
local speed = car.Chassis.CFrame:vectorToObjectSpace(car.Chassis.Velocity)
if offset.Z < 0 then
local direction = 1
if speed.Z > 0 then
direction = -1
end
wheelWeld.C0 = wheelWeld.C0 * CFrame.Angles(0, (car.Chassis.RotVelocity.Y / 2) * direction, 0)
end
also I know that the rotvelocity of Y is the orientation multiplying its value with -1 or 1 to go rotate it to left or right I guess…
Need a complete explanation to understand this code.Thanks.!