circular player collider
This commit is contained in:
parent
9bccd4eae3
commit
bc2dccb872
BIN
res/graphics/gun.ase
(Stored with Git LFS)
BIN
res/graphics/gun.ase
(Stored with Git LFS)
Binary file not shown.
BIN
res/graphics/tim.ase
(Stored with Git LFS)
BIN
res/graphics/tim.ase
(Stored with Git LFS)
Binary file not shown.
12
src/sim.c
12
src/sim.c
@ -188,17 +188,16 @@ INTERNAL struct sim_ent *spawn_test_player(struct sim_ctx *ctx)
|
|||||||
e->inertia_unscaled = 5;
|
e->inertia_unscaled = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
e->local_collider.points[0] = v2_with_len(V2(0.08f, 0.17f), 0.15f);
|
|
||||||
e->local_collider.points[1] = v2_with_len(V2(-0.07f, -0.2f), 0.15f);
|
|
||||||
e->local_collider.count = 2;
|
|
||||||
e->local_collider.radius = 0.075f;
|
|
||||||
|
|
||||||
//e->sprite = sprite_tag_from_path(LIT("res/graphics/box_rounded.ase"));
|
//e->sprite = sprite_tag_from_path(LIT("res/graphics/box_rounded.ase"));
|
||||||
//e->sprite_span_name = LIT("idle.unarmed");
|
//e->sprite_span_name = LIT("idle.unarmed");
|
||||||
//e->sprite_span_name = LIT("idle.one_handed");
|
//e->sprite_span_name = LIT("idle.one_handed");
|
||||||
e->sprite_span_name = LIT("idle.two_handed");
|
e->sprite_span_name = LIT("idle.two_handed");
|
||||||
e->layer = SIM_LAYER_SHOULDERS;
|
e->layer = SIM_LAYER_SHOULDERS;
|
||||||
|
|
||||||
|
e->local_collider.points[0] = V2(0, 0);
|
||||||
|
e->local_collider.count = 1;
|
||||||
|
e->local_collider.radius = 0.2f;
|
||||||
|
|
||||||
struct xform xf = XFORM_TRS(.t = pos, .r = r, .s = size);
|
struct xform xf = XFORM_TRS(.t = pos, .r = r, .s = size);
|
||||||
//xf.bx.y = -1.f;
|
//xf.bx.y = -1.f;
|
||||||
|
|
||||||
@ -1006,7 +1005,7 @@ void sim_update(struct sim_ctx *ctx, i64 target_dt_ns)
|
|||||||
joint_ent = sim_ent_alloc(root);
|
joint_ent = sim_ent_alloc(root);
|
||||||
joint_ent->mass_unscaled = F32_INFINITY;
|
joint_ent->mass_unscaled = F32_INFINITY;
|
||||||
joint_ent->inertia_unscaled = F32_INFINITY;
|
joint_ent->inertia_unscaled = F32_INFINITY;
|
||||||
sim_ent_enable_prop(joint_ent, SIM_ENT_PROP_PHYSICAL_KINEMATIC); /* Since we'll be setting velocity */
|
sim_ent_enable_prop(joint_ent, SIM_ENT_PROP_PHYSICAL_KINEMATIC); /* Since we'll be setting velocity manually */
|
||||||
sim_ent_enable_prop(joint_ent, SIM_ENT_PROP_MOTOR_JOINT);
|
sim_ent_enable_prop(joint_ent, SIM_ENT_PROP_MOTOR_JOINT);
|
||||||
sim_ent_enable_prop(joint_ent, SIM_ENT_PROP_ACTIVE);
|
sim_ent_enable_prop(joint_ent, SIM_ENT_PROP_ACTIVE);
|
||||||
ent->aim_joint = joint_ent->handle;
|
ent->aim_joint = joint_ent->handle;
|
||||||
@ -1022,7 +1021,6 @@ void sim_update(struct sim_ctx *ctx, i64 target_dt_ns)
|
|||||||
/* Set correction rate dynamically since motor velocity is only set for one frame */
|
/* Set correction rate dynamically since motor velocity is only set for one frame */
|
||||||
joint_ent->motor_joint_data.correction_rate = 10 * world_dt;
|
joint_ent->motor_joint_data.correction_rate = 10 * world_dt;
|
||||||
|
|
||||||
|
|
||||||
/* Solve for final angle using law of sines */
|
/* Solve for final angle using law of sines */
|
||||||
f32 new_angle;
|
f32 new_angle;
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user