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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
| |
|
2eggnog
|
  |
| Joined: 08 Nov 2008 |
| Total Posts: 1351 |
|
| |
|
|
| 24 Aug 2016 04:00 PM |
| 10 degrees higher not next to it |
|
|
| Report Abuse |
|
|
2eggnog
|
  |
| Joined: 08 Nov 2008 |
| Total Posts: 1351 |
|
|
| 24 Aug 2016 04:01 PM |
you dont know how cframing works.
|
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| Joined: 08 Nov 2008 |
| Total Posts: 1351 |
|
|
| 24 Aug 2016 04:11 PM |
| ############################################################################################################# |
|
|
| Report Abuse |
|
|
2eggnog
|
  |
| Joined: 08 Nov 2008 |
| Total Posts: 1351 |
|
|
| 24 Aug 2016 04:12 PM |
| ############################################################## |
|
|
| Report Abuse |
|
|
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
|
  |
| Joined: 08 Nov 2008 |
| Total Posts: 1351 |
|
|
| 24 Aug 2016 04:16 PM |
ive given up with the filter at this point
|
|
|
| Report Abuse |
|
|