|
| 27 Jul 2017 11:32 PM |
The way to make a ray, is by using "Ray.new(Vector3(Origin),Vector3(Direction))". Is there any way at all to calculate the Ray's direction by using orientation?
For example setting a ray with its Origin being a part in workspace, and its direction being the front facing Surface of the part? Thanks! |
|
|
| Report Abuse |
|
|
TruSight
|
  |
| Joined: 08 Nov 2010 |
| Total Posts: 983 |
|
|
| 28 Jul 2017 12:06 AM |
| local partInWorkspace = workspace.Part local ################ # ################################# partInWorkspace.CFrame.lookVector * 500) This'll cast a ray starting from the "front surface" of the part. |
|
|
| Report Abuse |
|
|
TruSight
|
  |
| Joined: 08 Nov 2010 |
| Total Posts: 983 |
|
|
| 28 Jul 2017 12:07 AM |
Ray.new(workspace.Part.CFrame.p, workspace.Part.CFrame.lookVector * 500)
Use lookVector to start at the "front surface" of the part.
|
|
|
| Report Abuse |
|
|
|
| 28 Jul 2017 12:12 AM |
| Thank you so much! Do you know how i could do the same thing, but with the Top surface? This is unnecessary, but would be helpful because this way the orientation will not be skewed by 90? |
|
|
| Report Abuse |
|
|
Smeers
|
  |
| Joined: 14 Feb 2013 |
| Total Posts: 797 |
|
|
| 28 Jul 2017 12:15 AM |
Use upVector instead of lookVector. Down would be negative upVector.
Valid vector values for CFrames are up, look, and right. |
|
|
| Report Abuse |
|
|
TruSight
|
  |
| Joined: 08 Nov 2010 |
| Total Posts: 983 |
|
|
| 28 Jul 2017 12:15 AM |
Instead of lookVector, use upVector (never tested that myself, but it does exist so should work)
|
|
|
| Report Abuse |
|
|