Login

Fancade Wiki

Updated Raycast.md (markdown)

... ...
@@ -1,13 +1,28 @@
1
Traces a line between two points and outputs **<span style="color:red">True</span>** if the line hits anything, the position of intersection, and the object it hit. (Think of it as a laser, you stand in the starting position and shoot a laser to the end position.)
1
[[/uploads/Raycast1.png|width=336px,alt=Raycast]]
2 2
3
Note that Raycast detects when the line hits the outside surface of a block. If the line starts *inside* the block then it will not hit that block when going out. Also, it won't detect an object that has been created in the same frame, you have to wait 1 frame after creating the object for Raycast to detect it.
3
Traces a line between two points and outputs [[True|Truth (True & False)]] if the line hits anything, the position of intersection, and the object it hit. (Think of it as a laser, you stand in the starting position and shoot a laser to the end position.)
4 4
5
It cannot detect [[Pass Through]]s and [[Script Block]]s.
5
Inputs:
6 6
7
[[/uploads/Raycast1.png|width=336px,alt=Raycast]]
7
- From: the endpoint of the line.
8
- To: the other endpoint of the line.
9
10
Outputs:
11
12
- Hit?: Returns whether the line hits an object.
13
- Hit Pos: The point where the object is detected, or [0, 0, 0] if it doesn't detect an object.
14
- Hit Obj: The object that was hit, or None if none is detected, or the ground is hit.
15
16
## Notes
17
18
- Note that Raycast detects when the line hits the outside surface of a block. If the line starts *inside* the block then it will not hit that block when going out. Also, it won't detect an object that has been created in the same frame, you have to wait 1 frame after creating the object for Raycast to detect it.
19
20
- It cannot detect [[Pass Through]]s and [[Script Block]]s.
8 21
9 22
## Raycast drawing
10 23
11 24
In edit mode, a visible line will be drawn between the start and end points: green if there is not a hit, red otherwise. This effect can be used to make red and green line drawings, but it won't be visible in play mode unless the level contains only scripting blocks and no normal blocks.
12 25
13
Because red lines require the presence of a non-scripting block, you must use a loophole to get them to appear in play mode. If a normal block is _inside_ a scripting block at the start of the level, it will not trigger the hiding of script blocks and Raycast lines. On the first frame the normal block can then be moved to the floor, and set to visible (being inside a scripting block makes it start not visible). Then set it in the path of a Raycast line to turn it red.
... ...
\ No newline at end of file
0
Because red lines require the presence of a non-scripting block, you must use a loophole to get them to appear in play mode. If a normal block is _inside_ a scripting block at the start of the level, it will not trigger the hiding of script blocks and Raycast lines. On the first frame the normal block can then be moved to the floor, and set to visible (being inside a scripting block makes it start not visible). Then set it in the path of a Raycast line to turn it red.
1
2
This is used in the game Swingflick by Origedit. Note a game cannot be featured using this.
... ...
\ No newline at end of file
Fancade Wiki