User Tools

Site Tools


en:tutorials:physics:raycasting

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
en:tutorials:physics:raycasting [2022/05/08 05:07 (3 years ago)] – created sausageen:tutorials:physics:raycasting [2022/05/08 23:03 (3 years ago)] (current) sausage
Line 41: Line 41:
     orx/code/bin/orxd.exe       orx/code/bin/orxd.exe  
  
-If you want to turn on the debug using the orx command, press the tilde key (''`'') and type: `Config.SetValue Physics ShowDebug true`+If you want to turn on the debug using the orx command, press the backtick key (''`'') and type: ''Set Physics ShowDebug true''
  
 While the demo is running, hold the ''Space'' key down. While the demo is running, hold the ''Space'' key down.
Line 69: Line 69:
 {{page>snippets:init_new_project&nofooter&noeditbutton}} {{page>snippets:init_new_project&nofooter&noeditbutton}}
  
-Next, rather than use the orx logo all the time, grab the blue rock and copy it to the ''data\texture'' folder.+Next, rather than use the orx logo all the time, grab the blue rock and copy it to the ''data/texture'' folder.
  
 {{ :en:tutorials:physics:ore.png?nolink |}} {{ :en:tutorials:physics:ore.png?nolink |}}
  
-Change the default [Object] section to use the ore.png texture (and make it smaller):+Change the default ''[Object]'' section to use the ore.png texture (and make it smaller):
  
 <code ini> <code ini>
Line 84: Line 84:
 </code> </code>
  
-Change the application to be a standard window so that you can easily get to the console window behind. We'll need to see our logging later.+Give that a quick run and you should get a rotating rock: 
 + 
 +{{ :en:tutorials:physics:object-for-raycasting.png?nolink |}} 
 + 
 +Change the application to be a standard window so that you can easily get to the console window behind. We'll need be able to see our logging later
 + 
 +<code ini> 
 +[Display] 
 +Decoration      = true 
 +... 
 +... 
 +</code>
  
 Add a body to the object so that physics will be enabled on it. Raycasts can only locate objects with bodies: Add a body to the object so that physics will be enabled on it. Raycasts can only locate objects with bodies:
Line 114: Line 125:
 ShowDebug = true ShowDebug = true
 </code> </code>
- 
-Give that a quick run and you should get a rotating rock with the physics debug border surrounding the object. 
- 
-{{ :en:tutorials:physics:object-for-raycasting.png?nolink |}} 
  
 Now to do the raycast on every frame. Add to the Update() function: Now to do the raycast on every frame. Add to the Update() function:
Line 184: Line 191:
 {{ :en:tutorials:physics:working-raycast.png?nolink |}} {{ :en:tutorials:physics:working-raycast.png?nolink |}}
  
-Raycsting is super handy. I hope you can use it to do some pretty cool things.+Raycasting is super handy. I hope you can use it to do some pretty cool things.
en/tutorials/physics/raycasting.1652011627.txt.gz · Last modified: 2022/05/08 05:07 (3 years ago) by sausage