Fix bobbing camera

This commit is contained in:
James Lambert 2023-08-26 14:45:59 -06:00
parent 0ed4fa8244
commit 17b6d10324
3 changed files with 5 additions and 3 deletions

View file

@ -107,10 +107,12 @@ void pointConstraintInit(struct PointConstraint* constraint, struct CollisionObj
constraint->teleportOnBreak = teleportOnBreak;
constraint->movementScaleFactor = movementScaleFactor;
constraint->object->body->flags &= ~RigidBodyIsSleeping;
constraint->object->body->sleepFrames = IDLE_SLEEP_FRAMES;
}
void pointConstraintUpdateTarget(struct PointConstraint* constraint, struct Vector3* worldPoint, struct Quaternion* worldRotation) {
constraint->targetPos = *worldPoint;
constraint->targetRot = *worldRotation;
constraint->object->body->flags &= ~RigidBodyIsSleeping;
constraint->object->body->sleepFrames = IDLE_SLEEP_FRAMES;
}

View file

@ -6,12 +6,9 @@
#include "defs.h"
#include <math.h>
#define VELOCITY_SLEEP_THRESHOLD 0.001f
#define ANGULAR_VELOCITY_SLEEP_THRESHOLD 0.001f
#define IDLE_SLEEP_FRAMES ((int)(0.5f / FIXED_DELTA_TIME))
void rigidBodyInit(struct RigidBody* rigidBody, float mass, float momentOfIniteria) {
transformInitIdentity(&rigidBody->transform);
rigidBody->velocity = gZeroVec;

View file

@ -6,6 +6,9 @@
#include "../math/mathf.h"
#include "./collision.h"
#define IDLE_SLEEP_FRAMES ((int)(0.5f / FIXED_DELTA_TIME))
#define KILL_PLANE_Y -10.0f
#define RIGID_BODY_NO_ROOM 0xFFFF