1 package com.neuronrobotics.bowlerstudio.physics;
3 import java.util.ArrayList;
6 import javax.vecmath.Matrix4f;
7 import javax.vecmath.Quat4f;
8 import javax.vecmath.Vector3f;
10 import com.bulletphysics.collision.shapes.*;
11 import com.bulletphysics.dynamics.RigidBody;
12 import com.bulletphysics.dynamics.RigidBodyConstructionInfo;
13 import com.bulletphysics.dynamics.constraintsolver.HingeConstraint;
14 import com.bulletphysics.dynamics.constraintsolver.TypedConstraint;
15 import com.bulletphysics.linearmath.DefaultMotionState;
16 import com.bulletphysics.linearmath.Transform;
17 import com.bulletphysics.util.ObjectArrayList;
19 import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR;
21 import eu.mihosoft.vrl.v3d.CSG;
22 import eu.mihosoft.vrl.v3d.Cube;
23 import eu.mihosoft.vrl.v3d.Polygon;
24 import eu.mihosoft.vrl.v3d.Sphere;
25 import eu.mihosoft.vrl.v3d.Vertex;
27 import javafx.application.Platform;
28 import javafx.scene.transform.Affine;
43 ObjectArrayList<Vector3f> arg0 =
new ObjectArrayList<>();
44 for (
int i = 0; i <
baseCSG.size(); i++) {
50 CollisionShape fallShape =
new com.bulletphysics.collision.shapes.ConvexHullShape(arg0);
55 this(
baseCSG,
new Transform(
new Matrix4f(
new Quat4f(0, 0, 0, 1), start, 1.0f)), mass,
true,
core);
68 finalCSG = finalCSG.
movex(-xcenter);
72 finalCSG = finalCSG.
movey(-ycenter);
76 finalCSG = finalCSG.
movez(-zcenter);
86 for (
Vertex v : p.vertices) {
87 arg0.add(
new Vector3f((
float) v.
getX(), (
float) v.
getY(), (
float) v.
getZ()));
110 DefaultMotionState fallMotionState =
new DefaultMotionState(pose);
112 Vector3f fallInertia =
new Vector3f(0, 0, 0);
113 fallShape.calculateLocalInertia((
float) mass, fallInertia);
114 RigidBodyConstructionInfo fallRigidBodyCI =
new RigidBodyConstructionInfo((
float) mass, fallMotionState,
115 fallShape, fallInertia);
117 fallRigidBodyCI.additionalDamping =
true;
127 }
catch (Exception e) {
void setBaseCSG(List< CSG > baseCSG)
void setFallRigidBody(RigidBody fallRigidBody)
Affine getRigidBodyLocation()
RigidBody getFallRigidBody()
IPhysicsUpdate getUpdateManager()
CSG loadCSGToPoints(CSG baseCSG, boolean adjustCenter, Transform pose, ObjectArrayList< Vector3f > arg0)
Transform getUpdateTransform()
CSGPhysicsManager(List< CSG > baseCSG, Transform pose, double mass, boolean adjustCenter, PhysicsCore core)
static CSG getBoundingBox(CSG incoming)
void setup(CollisionShape fallShape, Transform pose, double mass, PhysicsCore core)
CSGPhysicsManager(ArrayList< CSG > baseCSG, Vector3f start, double mass, PhysicsCore core)
final Affine ballLocation
void update(float timeStep)
IPhysicsUpdate updateManager
void setCore(PhysicsCore core)
void setUpdateManager(IPhysicsUpdate updateManager)
Transform updateTransform
CSG movez(Number howFarToMove)
CSG movex(Number howFarToMove)
List< Polygon > getPolygons()
CSG setManipulator(Affine manipulator)
CSG movey(Number howFarToMove)
void update(float timeStep)