Tramway SDK
api.h
Go to the documentation of this file.
1// TRAMWAY DRIFT AND DUNGEON EXPLORATION SIMULATOR 2022
2// All rights reserved.
3
4#ifndef TRAM_SDK_PHYSICS_API_H
5#define TRAM_SDK_PHYSICS_API_H
6
7#include <physics/physics.h>
9
11
16};
17
21 float distance;
22};
23
24typedef std::pair<vec3, quat>(*get_trf_callback)(void*);
25typedef void(*set_trf_callback)(void*, std::pair<vec3, quat>);
26typedef void(*col_callback)(void*, void*, ObjectCollision);
27
31
32rigidbody_t MakeRigidbody(collisionshape_t shape, float mass, vec3 position, quat rotation, uint32_t mask, uint32_t group, get_trf_callback get_callback, set_trf_callback set_callback, void* data);
33void YeetRigidbody(rigidbody_t rigidbody);
34void SetRigidbodyTransformCallback(rigidbody_t rigidbody, get_trf_callback get_callback, set_trf_callback set_callback, void* data);
35void SetRigidbodyCollisionCallback(rigidbody_t rigidbody, col_callback callback, void* data);
36void SetRigidbodyCollisionMask(rigidbody_t rigidbody, uint32_t mask);
37void SetRigidbodyCollisionGroup(rigidbody_t rigidbody, uint32_t group);
38void SetRigidbodyLocation(rigidbody_t rigidbody, vec3 location);
39void SetRigidbodyRotation(rigidbody_t rigidbody, quat rotation);
40void SetRigidbodyMass(rigidbody_t rigidbody, float mass);
41void PushRigidbody(rigidbody_t rigidbody, vec3 direction);
42void PushRigidbody(rigidbody_t rigidbody, vec3 direction, vec3 local);
43void SpinRigidbody(rigidbody_t rigidbody, vec3 direction);
44void SetRigidbodyDebugDrawing(rigidbody_t rigidbody, bool drawing);
45void SetRigidbodyKinematic(rigidbody_t rigidbody, bool kinematic);
46void SetRigidbodyAngularFactor(rigidbody_t rigidbody, vec3 factor);
47void SetRigidbodyLinearFactor(rigidbody_t rigidbody, vec3 factor);
48void SetRigidbodyVelocity(rigidbody_t rigidbody, vec3 velocity);
50void AwakenRigidbody(rigidbody_t rigidbody);
51void SleepRigidbody(rigidbody_t rigidbody);
53
54trigger_t MakeTrigger(collisionshape_t shape, uint32_t mask, uint32_t group, vec3 position, quat rotation);
56void SetTriggerCollisionCallback(trigger_t rigidbody, col_callback callback, void* data);
57void SetTriggerCollisionMask(trigger_t rigidbody, uint32_t mask);
58void SetTriggerCollisionGroup(trigger_t rigidbody, uint32_t group);
59void SetTriggerLocation(trigger_t rigidbody, vec3 location);
60void SetTriggerRotation(trigger_t rigidbody, quat location);
61
62std::pair<ObjectCollision, void*> Raycast(vec3 from, vec3 to, uint32_t collision_mask);
63std::vector<std::pair<ObjectCollision, void*>> Shapecast(CollisionShape shape, vec3 from, vec3 to, uint32_t collision_mask);
64
65void Init();
66void StepPhysics();
67void DrawDebug();
68void DrawDebug(bool);
69
70}
71
72#endif // TRAM_SDK_PHYSICS_API_H
Definition: api.h:10
void SetRigidbodyTransformCallback(rigidbody_t rigidbody, get_trf_callback get_callback, set_trf_callback set_callback, void *data)
void AwakenRigidbody(rigidbody_t rigidbody)
Definition: bullet.cpp:325
void StepPhysics()
Definition: bullet.cpp:516
void DrawDebug()
Definition: bullet.cpp:581
void SetRigidbodyCollisionGroup(rigidbody_t rigidbody, uint32_t group)
Definition: bullet.cpp:243
vec3 GetRigidbodyVelocity(rigidbody_t rigidbody)
Definition: bullet.cpp:320
trigger_t MakeTrigger(collisionshape_t shape, uint32_t mask, uint32_t group, vec3 position, quat rotation)
Definition: bullet.cpp:337
std::pair< vec3, quat >(* get_trf_callback)(void *)
Definition: api.h:24
void SetRigidbodyRotation(rigidbody_t rigidbody, quat rotation)
Definition: bullet.cpp:256
void SpinRigidbody(rigidbody_t rigidbody, vec3 direction)
Definition: bullet.cpp:276
void SetRigidbodyLinearFactor(rigidbody_t rigidbody, vec3 factor)
Definition: bullet.cpp:305
void YeetCollisionShape(collisionshape_t shape)
Definition: bullet.cpp:184
void SleepRigidbody(rigidbody_t rigidbody)
Definition: bullet.cpp:329
void DisableRigidbodyDeactivation(rigidbody_t rigidbody)
Definition: bullet.cpp:333
void Init()
Definition: bullet.cpp:489
rigidbody_t MakeRigidbody(collisionshape_t shape, float mass, vec3 position, quat rotation, uint32_t mask, uint32_t group, get_trf_callback get_callback, set_trf_callback set_callback, void *data)
Definition: bullet.cpp:189
void SetRigidbodyMass(rigidbody_t rigidbody, float mass)
Definition: bullet.cpp:262
void SetRigidbodyKinematic(rigidbody_t rigidbody, bool kinematic)
Definition: bullet.cpp:291
void SetRigidbodyCollisionMask(rigidbody_t rigidbody, uint32_t mask)
Definition: bullet.cpp:236
void YeetRigidbody(rigidbody_t rigidbody)
Definition: bullet.cpp:219
void SetTriggerLocation(trigger_t rigidbody, vec3 location)
Definition: bullet.cpp:394
void PushRigidbody(rigidbody_t rigidbody, vec3 direction)
Definition: bullet.cpp:266
void SetRigidbodyAngularFactor(rigidbody_t rigidbody, vec3 factor)
Definition: bullet.cpp:301
void(* set_trf_callback)(void *, std::pair< vec3, quat >)
Definition: api.h:25
void SetTriggerCollisionCallback(trigger_t rigidbody, col_callback callback, void *data)
Definition: bullet.cpp:377
void SetRigidbodyDebugDrawing(rigidbody_t rigidbody, bool drawing)
Definition: bullet.cpp:281
collisionshape_t MakeCollisionShape(CollisionShapeTransform *shapes, size_t shape_count)
Definition: bullet.cpp:155
void SetTriggerCollisionMask(trigger_t rigidbody, uint32_t mask)
Definition: bullet.cpp:382
void SetRigidbodyCollisionCallback(rigidbody_t rigidbody, col_callback callback, void *data)
Definition: bullet.cpp:231
void YeetTrigger(trigger_t)
Definition: bullet.cpp:372
std::pair< ObjectCollision, void * > Raycast(vec3 from, vec3 to, uint32_t collision_mask)
Definition: bullet.cpp:406
void SetRigidbodyLocation(rigidbody_t rigidbody, vec3 location)
Definition: bullet.cpp:250
void(* col_callback)(void *, void *, ObjectCollision)
Definition: api.h:26
void SetTriggerRotation(trigger_t rigidbody, quat location)
Definition: bullet.cpp:400
void SetRigidbodyVelocity(rigidbody_t rigidbody, vec3 velocity)
Definition: bullet.cpp:309
std::vector< std::pair< ObjectCollision, void * > > Shapecast(CollisionShape shape, vec3 from, vec3 to, uint32_t collision_mask)
Definition: bullet.cpp:463
void SetTriggerCollisionGroup(trigger_t rigidbody, uint32_t group)
Definition: bullet.cpp:388
glm::vec3 vec3
Definition: math.h:12
glm::quat quat
Definition: math.h:13
CollisionShape shape
Definition: api.h:13
vec3 point
Definition: api.h:19
vec3 normal
Definition: api.h:20
float distance
Definition: api.h:21
Definition: collisionshape.h:25
Definition: physics.h:44
Definition: physics.h:53
Definition: physics.h:48