feat(physics): rigidbodies can now be marked static
This commit is contained in:
parent
14877b0a28
commit
90dc3e1792
|
@ -20,6 +20,7 @@ struct RigidBody {
|
||||||
PhysicsMask collision_mask;
|
PhysicsMask collision_mask;
|
||||||
|
|
||||||
int overlap;
|
int overlap;
|
||||||
|
int is_static;
|
||||||
|
|
||||||
List contacts;
|
List contacts;
|
||||||
};
|
};
|
||||||
|
@ -159,6 +160,14 @@ void rigidbody_set_overlap(RigidBody* self, int value) {
|
||||||
self->overlap = 1;
|
self->overlap = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int rigidbody_is_static(RigidBody* self) {
|
||||||
|
return self->is_static;
|
||||||
|
}
|
||||||
|
|
||||||
|
void rigidbody_set_static(RigidBody* self, int value) {
|
||||||
|
self->is_static = value != 0;
|
||||||
|
}
|
||||||
|
|
||||||
Vector rigidbody_get_velocity(const RigidBody* self) {
|
Vector rigidbody_get_velocity(const RigidBody* self) {
|
||||||
return self->linear_velocity;
|
return self->linear_velocity;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
#include "collision.h"
|
#include "collision.h"
|
||||||
#include "stdint.h"
|
#include "stdint.h"
|
||||||
|
|
||||||
typedef uint32_t PhysicsMask;
|
|
||||||
|
|
||||||
struct Collision;
|
struct Collision;
|
||||||
typedef struct {
|
typedef struct {
|
||||||
struct Collision hit;
|
struct Collision hit;
|
||||||
|
@ -48,6 +46,9 @@ extern void rigidbody_set_collision_mask(RigidBody* self, PhysicsMask mask);
|
||||||
extern int rigidbody_get_overlap(RigidBody* self);
|
extern int rigidbody_get_overlap(RigidBody* self);
|
||||||
extern void rigidbody_set_overlap(RigidBody* self, int value);
|
extern void rigidbody_set_overlap(RigidBody* self, int value);
|
||||||
|
|
||||||
|
extern int rigidbody_is_static(RigidBody* self);
|
||||||
|
extern void rigidbody_set_static(RigidBody* self, int value);
|
||||||
|
|
||||||
extern Vector rigidbody_get_velocity(const RigidBody* self);
|
extern Vector rigidbody_get_velocity(const RigidBody* self);
|
||||||
extern void rigidbody_set_velocity(RigidBody* self, Vector velocity);
|
extern void rigidbody_set_velocity(RigidBody* self, Vector velocity);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue