generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Getting Angle of Surface using Rays

Previous Thread :: Next Thread 
kert109 is not online. 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 is not online. kert109
Joined: 31 Dec 2009
Total Posts: 681
02 Jun 2014 09:35 PM
Bump

May have to go to RbxDev forums..
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image