This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
en:tutorials:physics:raycasting [2022/05/08 05:07 (3 years ago)] – created sausage | en:tutorials:physics:raycasting [2022/05/08 23:03 (3 years ago)] (current) – sausage | ||
---|---|---|---|
Line 41: | Line 41: | ||
orx/ | orx/ | ||
- | If you want to turn on the debug using the orx command, press the tilde key ('' | + | If you want to turn on the debug using the orx command, press the backtick |
While the demo is running, hold the '' | While the demo is running, hold the '' | ||
Line 69: | Line 69: | ||
{{page> | {{page> | ||
- | Next, rather than use the orx logo all the time, grab the blue rock and copy it to the '' | + | Next, rather than use the orx logo all the time, grab the blue rock and copy it to the '' |
{{ : | {{ : | ||
- | Change the default [Object] section to use the ore.png texture (and make it smaller): | + | Change the default |
<code ini> | <code ini> | ||
Line 84: | Line 84: | ||
</ | </ | ||
- | 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: |
+ | |||
+ | {{ : | ||
+ | |||
+ | 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 | ||
+ | ... | ||
+ | ... | ||
+ | </ | ||
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 | ||
</ | </ | ||
- | |||
- | Give that a quick run and you should get a rotating rock with the physics debug border surrounding the object. | ||
- | |||
- | {{ : | ||
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: | ||
{{ : | {{ : | ||
- | Raycsting | + | Raycasting |