如何将物理节点绑定到场景节点?
由于文档显示当对物理节点进行更新时,它会传播到场景节点,我假设场景节点的变换矩阵也会更新。这个对吗?
例如,我有以下场景:
this.scene = Scene.create(this.devices.mathDevice);
this.sceneLoader.load({
scene : this.scene,
append : false,
assetPath : "models/duck.dae",
keepCameras : true,
baseMatrix: this.devices.mathDevice.m43BuildTranslation(0, 100, 0),
graphicsDevice: this.devices.graphicsDevice,
mathDevice : this.devices.mathDevice,
textureManager: this.managers.textureManager,
effectManager : this.managers.effectManager,
shaderManager : this.managers.shaderManager,
requestHandler: this.requestHandler,
dynamic : true
});
和以下物理节点:
var ballShape = this.devices.physicsDevice.createSphereShape({
radius: 1.0,
margin: 0.001
});
var mass = 20;
var inertia = ballShape.inertia;
inertia = this.devices.mathDevice.v3ScalarMul(inertia, mass);
var ballObject = this.devices.physicsDevice.createRigidBody({
shape : ballShape,
mass : mass,
inertia : inertia,
transform : this.scene.findNode("LOD3sp").getLocalTransform(),
friction : 0.5,
restitution: 0.3,
frozen : false,
group : this.devices.physicsDevice.FILTER_DYNAMIC,
mask : this.devices.physicsDevice.FILTER_ALL
});
this.dynamicsWorld.addCollisionObject(ballObject);
但我不知道如何将它们链接在一起,所以当物理球节点从高处坠落时,模型也会坠落。
在此先感谢您的帮助。