add angularly static collidables
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2024-08-16 16:02:25 -04:00
parent 1314ceac06
commit 893752098e
8 changed files with 43 additions and 4 deletions

View File

@ -376,7 +376,8 @@
"rotW": 1,
"offsetX" : 0,
"offsetY" : 0.4,
"offsetZ" : 0
"offsetZ" : 0,
"angularlyStatic" : true
},
"attackMoves" : [
{

View File

@ -19,7 +19,6 @@
Ticketed randomizer node for BTs to more heavily weight attacking and waiting
+ bug fixes
Fix physics freakout for vertically aligned entities
Fix entities running to edge of map causing audio engine to break
Fix broken rendering pipeline when creating new level

View File

@ -594,6 +594,7 @@ Fix unequipping item hard crashing engine
Fix terrain editing hard crashing engine
Fix attack animation mayyybe caching on non-local clients ??
Fix sword double-swing
Fix physics freakout for vertically aligned entities
# TODO

View File

@ -880,6 +880,21 @@ public class CollisionEngine {
spaceLock.release();
}
/**
* Sets whether the body is angularly static or not
* @param body The body
* @param angularlyStatic true if angularly static, false otherwise
*/
protected void setAngularlyStatic(DBody body, boolean angularlyStatic){
spaceLock.acquireUninterruptibly();
if(angularlyStatic){
body.setMaxAngularSpeed(0);
} else {
body.setMaxAngularSpeed(1000);
}
spaceLock.release();
}
/**
* Removes the geometry from the body
* @param body the body

View File

@ -56,6 +56,9 @@ public class PhysicsEntityUtils {
physicsTemplate.getOffsetX(), physicsTemplate.getOffsetY(), physicsTemplate.getOffsetZ(), //translate
physicsTemplate.getRotX(), physicsTemplate.getRotY(), physicsTemplate.getRotZ(), physicsTemplate.getRotW() //rotate
);
if(physicsTemplate.isAngularlyStatic()){
Globals.clientSceneWrapper.getCollisionEngine().setAngularlyStatic(rigidBody, true);
}
rVal.putData(EntityDataStrings.PHYSICS_COLLISION_BODY_TRANSFORM, offsetTransform);
rVal.putData(EntityDataStrings.PHYSICS_MODEL_TEMPLATE, physicsTemplate);
rVal.putData(EntityDataStrings.PHYSICS_COLLIDABLE, collidable);
@ -80,6 +83,9 @@ public class PhysicsEntityUtils {
physicsTemplate.getRotX(), physicsTemplate.getRotY(), physicsTemplate.getRotZ(), physicsTemplate.getRotW(), //rotate
1, 1, 1 //scale
);
if(physicsTemplate.isAngularlyStatic()){
Globals.clientSceneWrapper.getCollisionEngine().setAngularlyStatic(rigidBody, true);
}
rVal.putData(EntityDataStrings.PHYSICS_COLLISION_BODY_TRANSFORM, offsetTransform);
rVal.putData(EntityDataStrings.PHYSICS_MODEL_TEMPLATE, physicsTemplate);
rVal.putData(EntityDataStrings.PHYSICS_COLLIDABLE, collidable);
@ -129,6 +135,9 @@ public class PhysicsEntityUtils {
physicsTemplate.getRotX(), physicsTemplate.getRotY(), physicsTemplate.getRotZ(), physicsTemplate.getRotW(), //rotate
1, 1, 1 //scale
);
if(physicsTemplate.isAngularlyStatic()){
realm.getCollisionEngine().setAngularlyStatic(rigidBody, true);
}
rVal.putData(EntityDataStrings.PHYSICS_COLLISION_BODY_TRANSFORM, offsetTransform);
rVal.putData(EntityDataStrings.PHYSICS_MODEL_TEMPLATE, physicsTemplate);
rVal.putData(EntityDataStrings.PHYSICS_COLLIDABLE, collidable);
@ -149,6 +158,9 @@ public class PhysicsEntityUtils {
physicsTemplate.getRotX(), physicsTemplate.getRotY(), physicsTemplate.getRotZ(), physicsTemplate.getRotW(), //rotate
1, 1, 1 //scale
);
if(physicsTemplate.isAngularlyStatic()){
realm.getCollisionEngine().setAngularlyStatic(rigidBody, true);
}
rVal.putData(EntityDataStrings.PHYSICS_COLLISION_BODY_TRANSFORM, offsetTransform);
rVal.putData(EntityDataStrings.PHYSICS_MODEL_TEMPLATE, physicsTemplate);
rVal.putData(EntityDataStrings.PHYSICS_COLLIDABLE, collidable);

View File

@ -39,7 +39,6 @@ public class ClientAlwaysUprightTree implements BehaviorTree {
Vector3d angularForce = new Vector3d();
//make sure rotation is vertical
body.setMaxAngularSpeed(0);
// sourceRotation = sourceRotation.mul(0.001, 1, 0.001, 1).normalize();
EntityUtils.getPosition(parent).set(position);

View File

@ -42,7 +42,6 @@ public class ServerAlwaysUprightTree implements BehaviorTree {
Vector3d angularForce = new Vector3d();
//make sure rotation is vertical
body.setMaxAngularSpeed(0);
// sourceRotation = sourceRotation.mul(0.001, 0.001, 0.001, 1).normalize();
EntityUtils.getPosition(parent).set(position);

View File

@ -20,6 +20,11 @@ public class CollidableTemplate {
float offsetY;
float offsetZ;
/**
* Controls whether the body can rotate or not
*/
boolean angularlyStatic;
public String getType() {
return type;
}
@ -63,6 +68,14 @@ public class CollidableTemplate {
public float getOffsetZ() {
return offsetZ;
}
/**
* Gets if the body should always be allowed to rotate or not
* @return true if should always be allowed to rotate, false otherwise
*/
public boolean isAngularlyStatic(){
return this.angularlyStatic;
}