Module blitwizard.physics
The blitwizard physics namespace contains various physics functions for collision tests and the like.
You would handle most physics functionality by using functions of the blitwizard object though.
Info:
- Copyright: 2011-2013
- License: zlib
- Author: Jonas Thiem (jonas.thiem@gmail.com) et al
Functions
ray2d (startx, starty, targetx, targety) | Do a ray collision test by shooting out a ray and checking where it hits in 2d realm. |
ray3d (startx, starty, startz, targetx, targety, targetz) | Do a ray collision test by shooting out a ray and checking where it hits in 3d realm. |
set2dGravity (x, y) | Set the world gravity for all 2d objects. |
set3dGravity () | Set the world gravity for all 3d objects. |
Functions
- ray2d (startx, starty, targetx, targety)
-
Do a ray collision test by shooting out a ray and checking where it hits
in 2d realm.
Parameters:
- startx number Ray starting point, x coordinate (please note the starting point shouldn't be inside the collision shape of an object)
- starty number Ray starting point, y coordinate
- targetx number Ray target point, x coordinate
- targety number Ray target point, y coordinate
Returns:
-
userdata
Returns a blitwizard object if an object was hit by the ray (the closest object that was hit), or otherwise it returns nil
- ray3d (startx, starty, startz, targetx, targety, targetz)
-
Do a ray collision test by shooting out a ray and checking where it hits
in 3d realm.
Parameters:
- startx number Ray starting point, x coordinate (please note the starting point shouldn't be inside the collision shape of an object)
- starty number Ray starting point, y coordinate
- startz number Ray starting point, z coordinate
- targetx number Ray target point, x coordinate
- targety number Ray target point, y coordinate
- targetz number Ray target point, z coordinate
Returns:
-
userdata
Returns a blitwizard object if an object was hit by the ray (the closest object that was hit), or otherwise it returns nil
- set2dGravity (x, y)
-
Set the world gravity for all 2d objects.
Parameters:
- x number gravity force on x axis
- y number gravity force on y axis
- set3dGravity ()
- Set the world gravity for all 3d objects.