kert109
|
  |
| Joined: 31 Dec 2009 |
| Total Posts: 681 |
|
|
| 02 Jun 2014 09:17 PM |
I'm trying to make a vehicle angle to where it's parallel to the object underneath. I'm using the ray casting method to accomplish this, but it seems to glitch out. My friend told me to do it this way. Here's the code:
-- This is put in a while loop. Pos1 and Pos2 is where the rays are hitting. -- The rest should be obvious.
local CF1 = CFrame.new(Pos1):toObjectSpace(CenterPart.CFrame) local CF2 = CFrame.new(Pos2):toObjectSpace(CenterPart.CFrame) CurrentTurnAngle = CurrentTurnAngle+math.rad(-Turn*4)
bodyGyro.cframe = CFrame.Angles(math.atan2(CF1.y-CF2.y,CF1.x-CF2.x),CurrentTurnAngle,0)
bodyVel.velocity = CenterPart.CFrame.lookVector*(Speed)
Anyone have a clue or another reliable method? BTW, if you happen to be a free modeler and you have a script that uses this, please just give me the function. qq I'm desperate. |
|
|
| Report Abuse |
|
kert109
|
  |
| Joined: 31 Dec 2009 |
| Total Posts: 681 |
|
|
| 02 Jun 2014 09:35 PM |
Bump
May have to go to RbxDev forums.. |
|
|
| Report Abuse |
|