physics are on fun evil mode
This commit is contained in:
parent
8ab8c06f9c
commit
8a92f99474
3 changed files with 899 additions and 880 deletions
1748
LastSession.t4jlog
1748
LastSession.t4jlog
File diff suppressed because it is too large
Load diff
|
|
@ -32,11 +32,11 @@ public class RigidPhysicsController implements IPhysicsController {
|
|||
public static RigidBody Wall4 = new RigidBody("WALL4",ConvexMesh.Box(10,100f,100),0);
|
||||
|
||||
static {
|
||||
Ground.Position.set(0,-100f,0);
|
||||
Wall.Position.set(0,0f,-60f);
|
||||
Wall2.Position.set(0,0f,60f);
|
||||
Wall3.Position.set(-60f,0f,0);
|
||||
Wall4.Position.set(60f,0f,0);
|
||||
Ground.Position.set(0,-110f,0);
|
||||
Wall.Position.set(0,-11f,-60f);
|
||||
Wall2.Position.set(0,-11f,60f);
|
||||
Wall3.Position.set(-60f,-11f,0);
|
||||
Wall4.Position.set(60f,-11f,0);
|
||||
}
|
||||
|
||||
public String RigidBodyID = "NULL";
|
||||
|
|
|
|||
|
|
@ -160,6 +160,11 @@ public class GameCore implements GameLogic {
|
|||
for(int i = 0; i < ActorEditorComponents.size(); i++){
|
||||
ActorEditorComponents.get(i).UpdateAll();
|
||||
}
|
||||
for(int x = -5; x < 6; x++){
|
||||
for(int y = -5; y < 6; y++){
|
||||
SpawnNewStaticActor(engineInstance, new Vector3f(x * 4f, -4 *(float)Math.random(), y * 4f), new Vector3f(0,0,0),new Vector3f(1,1,1));
|
||||
}
|
||||
}
|
||||
return new InitData(models,materials,guiTextures);
|
||||
}
|
||||
|
||||
|
|
@ -173,6 +178,22 @@ public class GameCore implements GameLogic {
|
|||
SpawnNewActorEditorComponent(engineInstance, new Vector3f(camera.GetPosition()),camera.GetRotation(),camera.GetDirection());
|
||||
}
|
||||
|
||||
public void SpawnNewStaticActor(EngineInstance engineInstance, Vector3f Position, Vector3f Rotation, Vector3f Direction){
|
||||
var scene = engineInstance.scene();
|
||||
Camera camera = scene.GetCamera();
|
||||
SpawnPosition.set(Position);
|
||||
rotationMatrix.set(new Matrix4f().rotateX(Rotation.x).rotateY(Rotation.y).rotateZ(Rotation.z));
|
||||
SpawnDirection.set(new Vector3f(Direction));
|
||||
rotationMatrix.positiveZ(SpawnDirection).negate().mul(5);
|
||||
SpawnPosition.add(SpawnDirection);
|
||||
var Melona = new Actor("MelonaSpawned" + scene.GetActors().size(), MelonaData.ID(), new Vector3f(SpawnPosition));
|
||||
Melona.SetScale(4f);
|
||||
Melona.CreatePhysicsController( ConvexMesh.Box(2.0f,2.0f,2.0f),0);
|
||||
RigidPhysicsController physicsController = (RigidPhysicsController) Melona.GetPhysicsController();
|
||||
//RigidBody.RigidBodyRegister.get(physicsController.RigidBodyID).LinearVelocity.set(0,0,-20f -(40f * (float)Math.random()));
|
||||
scene.AddActor(Melona);
|
||||
}
|
||||
|
||||
public void SpawnNewActor(EngineInstance engineInstance, Vector3f Position, Vector3f Rotation, Vector3f Direction){
|
||||
var scene = engineInstance.scene();
|
||||
Camera camera = scene.GetCamera();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue