mirror of
https://github.com/mwpenny/portal64-still-alive.git
synced 2024-11-26 22:00:25 +00:00
Merge pull request #56 from Deconimus/issue41_fizzler_frame_collision
Add collision for fizzler frames
This commit is contained in:
commit
73e81b3308
@ -45,6 +45,18 @@ struct Transform gRelativeRight = {
|
||||
{1.0f, 1.0f, 1.0f},
|
||||
};
|
||||
|
||||
struct CollisionBox gFizzlerFrameBox = {
|
||||
{0.125f, 1.0f, 0.125f}
|
||||
};
|
||||
|
||||
struct ColliderTypeData gFizzlerFrameCollider = {
|
||||
CollisionShapeTypeBox,
|
||||
&gFizzlerFrameBox,
|
||||
0.0f,
|
||||
1.0f,
|
||||
&gCollisionBoxCallbacks
|
||||
};
|
||||
|
||||
void fizzlerRender(void* data, struct DynamicRenderDataList* renderList, struct RenderState* renderState) {
|
||||
struct Fizzler* fizzler = (struct Fizzler*)data;
|
||||
|
||||
@ -144,18 +156,38 @@ void fizzlerInit(struct Fizzler* fizzler, struct Transform* transform, float wid
|
||||
|
||||
collisionObjectInit(&fizzler->collisionObject, &fizzler->colliderType, &fizzler->rigidBody, 1.0f, COLLISION_LAYERS_FIZZLER | COLLISION_LAYERS_BLOCK_PORTAL);
|
||||
rigidBodyMarkKinematic(&fizzler->rigidBody);
|
||||
collisionObjectInit(&fizzler->frameLeftCollisionObject, &gFizzlerFrameCollider, &fizzler->frameLeftRigidBody, 1.0f, COLLISION_LAYERS_TANGIBLE);
|
||||
rigidBodyMarkKinematic(&fizzler->frameLeftRigidBody);
|
||||
collisionObjectInit(&fizzler->frameRightCollisionObject, &gFizzlerFrameCollider, &fizzler->frameRightRigidBody, 1.0f, COLLISION_LAYERS_TANGIBLE);
|
||||
rigidBodyMarkKinematic(&fizzler->frameRightRigidBody);
|
||||
|
||||
fizzler->collisionObject.trigger = fizzlerTrigger;
|
||||
fizzler->collisionObject.data = fizzler;
|
||||
|
||||
fizzler->rigidBody.transform = *transform;
|
||||
fizzler->rigidBody.currentRoom = room;
|
||||
|
||||
|
||||
struct Vector3 left = {-1.0f, 0.0f, 0.0f};
|
||||
quatMultVector(&transform->rotation, &left, &left);
|
||||
fizzler->frameLeftRigidBody.transform = *transform;
|
||||
vector3AddScaled(&transform->position, &left, width - gFizzlerFrameBox.sideLength.x, &fizzler->frameLeftRigidBody.transform.position);
|
||||
fizzler->frameLeftRigidBody.currentRoom = room;
|
||||
|
||||
struct Vector3 right;
|
||||
vector3Negate(&left, &right);
|
||||
fizzler->frameRightRigidBody.transform = *transform;
|
||||
vector3AddScaled(&transform->position, &right, width - gFizzlerFrameBox.sideLength.x, &fizzler->frameRightRigidBody.transform.position);
|
||||
fizzler->frameRightRigidBody.currentRoom = room;
|
||||
|
||||
fizzler->cubeSignalIndex = cubeSignalIndex;
|
||||
|
||||
|
||||
collisionObjectUpdateBB(&fizzler->collisionObject);
|
||||
collisionObjectUpdateBB(&fizzler->frameLeftCollisionObject);
|
||||
collisionObjectUpdateBB(&fizzler->frameRightCollisionObject);
|
||||
|
||||
collisionSceneAddDynamicObject(&fizzler->collisionObject);
|
||||
|
||||
collisionSceneAddDynamicObject(&fizzler->frameLeftCollisionObject);
|
||||
collisionSceneAddDynamicObject(&fizzler->frameRightCollisionObject);
|
||||
|
||||
fizzler->maxExtent = (int)(maxf(0.0f, width - 0.5f) * SCENE_SCALE);
|
||||
fizzler->maxVerticalExtent = (int)(height * SCENE_SCALE);
|
||||
|
||||
|
@ -18,7 +18,11 @@
|
||||
|
||||
struct Fizzler {
|
||||
struct CollisionObject collisionObject;
|
||||
struct CollisionObject frameLeftCollisionObject;
|
||||
struct CollisionObject frameRightCollisionObject;
|
||||
struct RigidBody rigidBody;
|
||||
struct RigidBody frameLeftRigidBody;
|
||||
struct RigidBody frameRightRigidBody;
|
||||
struct ColliderTypeData colliderType;
|
||||
struct CollisionBox collisionBox;
|
||||
Vtx* modelVertices;
|
||||
|
Loading…
Reference in New Issue
Block a user