Fix misaligned physics problem
This commit is contained in:
parent
863fd4b665
commit
c2380b0bdc
@ -12,8 +12,8 @@
|
||||
"graphicsPerformanceEnableVSync" : false,
|
||||
"graphicsPerformanceDrawShadows" : true,
|
||||
|
||||
"graphicsDebugDrawCollisionSpheres" : false,
|
||||
"graphicsDebugDrawPhysicsObjects" : false,
|
||||
"graphicsDebugDrawCollisionSpheres" : true,
|
||||
"graphicsDebugDrawPhysicsObjects" : true,
|
||||
"graphicsDebugDrawMovementVectors" : false,
|
||||
"graphicsDebugDrawNavmesh" : false
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@ import electrosphere.entity.EntityUtils;
|
||||
import electrosphere.entity.state.GravityTree;
|
||||
import electrosphere.game.collision.PhysicsUtils;
|
||||
import electrosphere.game.collision.collidable.Collidable;
|
||||
import electrosphere.game.data.creature.type.CollidableTemplate;
|
||||
import electrosphere.main.Globals;
|
||||
import org.joml.Quaternionf;
|
||||
import org.joml.Vector3d;
|
||||
@ -80,7 +81,8 @@ public class CollidableTree {
|
||||
position.set(newPosition);
|
||||
|
||||
//update collision engine of this thing's position
|
||||
bodyTransformMatrix = new javax.vecmath.Matrix4f(PhysicsUtils.jomlToVecmathQuaternionf(rotation),PhysicsUtils.jomlToVecmathVector3f(new Vector3f((float)position.x,(float)position.y,(float)position.z)),1.0f);
|
||||
CollidableTemplate template = (CollidableTemplate)parent.getData(EntityDataStrings.PHYSICS_MODEL_TEMPLATE);
|
||||
bodyTransformMatrix = new javax.vecmath.Matrix4f(PhysicsUtils.jomlToVecmathQuaternionf(rotation),PhysicsUtils.jomlToVecmathVector3f(new Vector3f((float)position.x + template.getOffsetX(),(float)position.y + template.getOffsetY(),(float)position.z + template.getOffsetZ())),1.0f);
|
||||
body.setWorldTransform(new electrosphere.linearmath.Transform(bodyTransformMatrix));
|
||||
|
||||
// bodyTransformMatrix = new javax.vecmath.Matrix4f(PhysicsUtils.jomlToVecmathQuaternionf(rotation),PhysicsUtils.jomlToVecmathVector3f(new Vector3f((float)newPosition.x,(float)newPosition.y,(float)newPosition.z)),1.0f);
|
||||
|
||||
@ -107,8 +107,8 @@ public class ServerConnectionHandler implements Runnable {
|
||||
Globals.dataCellManager.addPlayer(newPlayerObject);
|
||||
Globals.dataCellManager.movePlayer(newPlayerObject, Globals.serverWorldData.convertRealToChunkSpace(Globals.spawnPoint.x), Globals.serverWorldData.convertRealToChunkSpace(Globals.spawnPoint.z));
|
||||
//spawn player sword
|
||||
// Entity sword = ItemUtils.spawnBasicItem("Katana");
|
||||
// AttachUtils.attachEntityToEntityAtBone(newPlayerCharacter, sword, "Bone.031");
|
||||
Entity sword = ItemUtils.spawnBasicItem("Katana");
|
||||
AttachUtils.attachEntityToEntityAtBone(newPlayerCharacter, sword, "Bone.031");
|
||||
//set controller id
|
||||
CreatureUtils.setControllerPlayerId(newPlayerCharacter, playerID);
|
||||
if(Globals.RUN_SERVER && Main.playerId == -1){
|
||||
|
||||
Loading…
Reference in New Issue
Block a user