-
加載的外部模型沒有物理特性
因為physijs自身沒有加載模塊,所以加載的時候需要用physijs的方法拷貝外部模型
var objLoader = new THREE.OBJLoader();
objLoader.load('xxx.obj',function(object){
var model = object;
for (let x in model.children){
let material = Physijs.createMaterial(
model.children[x].material,
1,
0
);
let mesh = new Physijs.BoxMesh(
model.children[x].geometry,
material,
0
);
mesh.castShadow = true;
mesh.receiveShadow = true;
scene.add(mesh);
}
},onProgress,onError);
<br />
-
不能同時向場景加入多個元素
scene.add(obj1,obj2)
原本three.js是支持這樣的做法的爷怀,但是physijs中這種寫法只會加載第一個元素
<br />
-
直接改變元素的位置或角度時必須要設置參數
// Change the object's position
mesh.position.set( 0, 0, 0 );
mesh.__dirtyPosition = true;
// Change the object's rotation
mesh.rotation.set(0, 90, 180);
mesh.__dirtyRotation = true;
推薦的做法是給物體一個線速度或者角速度
// use linear velocity to change rotation
mesh.setLinearVelocity(new THREE.Vector3(0, 0, 1));
// use angular velocity to change rotation
mesh.setAngularVelocity(new THREE.Vector3(0, 1, 0));
但是這有個問題浴井,直接改變的做法動畫是很流暢的,但是用速度矢量畫面會有一頓一頓的情況霉撵,暫未能解決磺浙。
<br />
-
直接改變角度無法超過90度
直接解決的辦法還沒找到,用角速度的方法是沒問題的徒坡。
相關issue:issue137撕氧,issue170
監(jiān)控物體的rotation可以發(fā)現在y在90度附近時rotation的x和z在-PI,0喇完,PI之間反復變動的情況
此外根據issue223中jimver04的回復我嘗試把fixedTimeStep改成1/20伦泥,結果是可以超過90度了,但是時不時會出現物體翻轉的情況。