Update leenkx/Sources/leenkx/trait/physics/bullet/PhysicsWorld.hx
This commit is contained in:
parent
4b6424b702
commit
12e66d8cf1
@ -85,6 +85,22 @@ class PhysicsWorld extends Trait {
|
|||||||
public static var physTime = 0.0;
|
public static var physTime = 0.0;
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
public static function getSolverInfo(world:bullet.Bt.DynamicsWorld):Dynamic {
|
||||||
|
return Reflect.callMethod(world, Reflect.field(world, "getSolverInfo"), []);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function setSolverIterations(world:bullet.Bt.DynamicsWorld, iterations:Int):Void {
|
||||||
|
var solverInfo = getSolverInfo(world);
|
||||||
|
if (solverInfo != null) {
|
||||||
|
Reflect.setField(solverInfo, "m_numIterations", iterations);
|
||||||
|
} else {
|
||||||
|
trace("Warning: Could not access solver info. Solver iterations not applied.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function new(timeScale = 1.0, maxSteps = 10, solverIterations = 10, debugDrawMode: DebugDrawMode = NoDebug) {
|
public function new(timeScale = 1.0, maxSteps = 10, solverIterations = 10, debugDrawMode: DebugDrawMode = NoDebug) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
@ -164,7 +180,8 @@ class PhysicsWorld extends Trait {
|
|||||||
#else
|
#else
|
||||||
world = new bullet.Bt.DiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);
|
world = new bullet.Bt.DiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);
|
||||||
#end
|
#end
|
||||||
|
// Set the solver iterations from Blender's rigid body world
|
||||||
|
setSolverIterations(world, solverIterations);
|
||||||
setGravity(gravity);
|
setGravity(gravity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user