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 » Scripters
Home Search
 

Re: Ray question

Previous Thread :: Next Thread 
WoolHat is not online. WoolHat
Joined: 19 May 2013
Total Posts: 1873
24 Aug 2016 03:34 PM
Here's an example.. as simplified as I could make it:
Origin point is (0,0,0)

I have an second point at (10,0,0)

And I want a ray that goes to say, 10 degrees higher than the second point. How would I achieve that? I just can't think of the math to do it.

Also, would I modify the .unit, or the Non-unit vector?
Report Abuse
2eggnog is not online. 2eggnog
Joined: 08 Nov 2008
Total Posts: 1351
24 Aug 2016 03:38 PM
(10*math.cos(math.rad(10)), 10*math.sin(math.rad(10)), 0)


Report Abuse
WrightPhillips99 is not online. WrightPhillips99
Joined: 27 Jun 2015
Total Posts: 667
24 Aug 2016 03:38 PM
magnitude
local distance = (tool.CFrame.hit.p(mouse.hit.p-tool.CFrame.hit.P).unit*300*CFrame.new(0,10,0)*
something like that would help.
Report Abuse
2eggnog is not online. 2eggnog
Joined: 08 Nov 2008
Total Posts: 1351
24 Aug 2016 03:50 PM
I suppose you could also convert it to a CFrame:
local cf = CFrame.new(origin, point)
then transform it:
cf = cf*CFrame.Angles(math.rad(10), 0, 0)
and then turn it back into a Ray:
Ray.new(cf.p, cf.lookVector*original_magnitude)


Report Abuse
WrightPhillips99 is not online. WrightPhillips99
Joined: 27 Jun 2015
Total Posts: 667
24 Aug 2016 03:55 PM
the first spot is x
Report Abuse
2eggnog is not online. 2eggnog
Joined: 08 Nov 2008
Total Posts: 1351
24 Aug 2016 03:58 PM
.. ok?


Report Abuse
WrightPhillips99 is not online. WrightPhillips99
Joined: 27 Jun 2015
Total Posts: 667
24 Aug 2016 04:00 PM
10 degrees higher not next to it
Report Abuse
2eggnog is not online. 2eggnog
Joined: 08 Nov 2008
Total Posts: 1351
24 Aug 2016 04:01 PM
you dont know how cframing works.


Report Abuse
WoolHat is not online. WoolHat
Joined: 19 May 2013
Total Posts: 1873
24 Aug 2016 04:01 PM
Thanks for the responses, I'll try them when I get back. I've always been a bit confused about Cframe lookvectors. Is it like the .p property, but instead returns to non-position component?
Report Abuse
2eggnog is not online. 2eggnog
Joined: 08 Nov 2008
Total Posts: 1351
24 Aug 2016 04:04 PM
It refers to the negative z component of its rotation. In other words, it's a Vector which everyone has agreed to describe the direction the object is facing, much like the direction component of a Ray.


Report Abuse
2eggnog is not online. 2eggnog
Joined: 08 Nov 2008
Total Posts: 1351
24 Aug 2016 04:11 PM
#############################################################################################################
Report Abuse
2eggnog is not online. 2eggnog
Joined: 08 Nov 2008
Total Posts: 1351
24 Aug 2016 04:12 PM
##############################################################
Report Abuse
Skellobit is not online. Skellobit
Joined: 13 Apr 2016
Total Posts: 12758
24 Aug 2016 04:13 PM
lol
-2 rep

Formerly ToxicDominator - add 17,509 posts
Report Abuse
2eggnog is not online. 2eggnog
Joined: 08 Nov 2008
Total Posts: 1351
24 Aug 2016 04:16 PM
ive given up with the filter at this point


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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