Open Dev Kit Documentation :: Demo - 3D Physics
Very simple 3D physics-based ball throwing game utilizingHow it Works
- Game Initialization
- Player Controls
- The
Controls Keybinds Resource is responsible for the camera's 3D movement as well as the aiming/shooting. Players can move the camera freely using standard WASD controls, use Space/Shift for ascending/descending, rotate their view by right-clicking and dragging with the mouse, and fire projectiles with the left mouse button. - Shooting & Physics Interaction
- When the left mouse button is pressed, a bullet is spawned and launched toward the player's aim direction. Objects hit by the bullet will react thanks to
Jolt physics being set in .The variableTools >Project Options gBullet has aTicked Event which is responsible for despawning bullet actors that leave theScene (fall below a height of Z=-500). Since the variable is of type "Actor" it also has properties for controlling the bullet actor's model, scale, color etc.
Adding New Objects to the Scene
Follow these steps to add a new shape to the demo:
- Create the New Object:
- Open
.Tools >Resources - Double-click the
Sprites Sprite Resource . - Select an empty tile and click the
Import Images/Model icon to import your 3D model. You may have to configure its scale and rotation. - Depending on the shape of the model you are importing, click the
Add Box Collision /Add Capsule Collision icon ("Shared with whole Tile") to add a new collision box to the sequencer. - Line it up with the model.
- Open
- Place the New Object:
- Load
StartScene . - Double click on the
Actor object to create it. - On the
Properties panel find and click+ besideLayers . - On
Sprite put the demo's main sprite resource which isSprites , and set itsTile below to3 . The count of the tiles in aSprite Resource starts from 0, therefore the 4th tile's # would be 3. - Set its
Physics Restitution to a low value like0.5 (make sure its is set toPhysics Type Dynamic ).
- Load
- Test the Game:
- Run the project to verify the new object works as expected.
If you think anything is missing, please feel free to: submit documentation feedback on this page