[LayaAir3]动态添加2d物理引擎shape无效
let sp = new Laya.Sprite();
var rig = new Laya.RigidBody();
//rig.type = "dynamic";
rig.bullet = true;
let shape = new Laya.CircleShape2D();
shape.x = -10;
shape.y = -10;
shape.restitution = 1;
shape.friction = 1;
shape.radius = 100;
rig.gravityScale = 0;
rig.angularDamping = 10000;
rig.linearVelocity = new Laya.Vector2(10000, 0);
rig.linearDamping = 1;
//设置动态添加的Sprite节点的shape无效
rig.shapes = [shape];
sp.addComponentInstance(rig);
this.Sprite.parent.addChild(sp);
//设置ide中Sprite节点的shape有效
this.Sprite.getComponent(Laya.RigidBody).shapes = [shape];
var rig = new Laya.RigidBody();
//rig.type = "dynamic";
rig.bullet = true;
let shape = new Laya.CircleShape2D();
shape.x = -10;
shape.y = -10;
shape.restitution = 1;
shape.friction = 1;
shape.radius = 100;
rig.gravityScale = 0;
rig.angularDamping = 10000;
rig.linearVelocity = new Laya.Vector2(10000, 0);
rig.linearDamping = 1;
//设置动态添加的Sprite节点的shape无效
rig.shapes = [shape];
sp.addComponentInstance(rig);
this.Sprite.parent.addChild(sp);
//设置ide中Sprite节点的shape有效
this.Sprite.getComponent(Laya.RigidBody).shapes = [shape];
没有找到相关结果
已邀请:
要回复问题请先登录
0 个回复