fix item collection i guess??

This commit is contained in:
RandomityGuy 2022-12-19 19:07:07 +05:30
parent 1c7ad635f8
commit affbceda51
2 changed files with 24 additions and 9 deletions

View file

@ -13,7 +13,7 @@ import h3d.col.Bounds;
class BoxCollisionEntity extends CollisionEntity {
var bounds:Bounds;
var _dbgEntity:h3d.scene.Mesh;
var _dbgEntity:h3d.scene.Object;
public function new(bounds:Bounds, go:GameObject) {
super(go);
@ -25,22 +25,22 @@ class BoxCollisionEntity extends CollisionEntity {
this.boundingBox = bounds.clone();
this.boundingBox.transform(this.transform);
// if (_dbgEntity == null) {
// var cube = new h3d.prim.Cube(this.boundingBox.xSize, this.boundingBox.ySize, this.boundingBox.zSize, true);
// cube.addNormals();
// cube.addUVs();
// _dbgEntity = new h3d.scene.Mesh(cube);
// _dbgEntity.material.mainPass.wireframe = true;
// _dbgEntity.setTransform(transform);
// _dbgEntity = this.boundingBox.makeDebugObj();
// _dbgEntity.getMaterials()[0].mainPass.wireframe = true;
// MarbleGame.instance.scene.addChild(_dbgEntity);
// } else {
// _dbgEntity.setTransform(transform);
// _dbgEntity = this.boundingBox.makeDebugObj();
// _dbgEntity.getMaterials()[0].mainPass.wireframe = true;
// MarbleGame.instance.scene.addChild(_dbgEntity);
// }
}
public override function setTransform(transform:Matrix) {
super.setTransform(transform);
// if (_dbgEntity != null) {
// _dbgEntity.setTransform(transform);
// _dbgEntity = this.boundingBox.makeDebugObj();
// _dbgEntity.getMaterials()[0].mainPass.wireframe = true;
// MarbleGame.instance.scene.addChild(_dbgEntity);
// }
}

View file

@ -14,6 +14,7 @@ class SphereCollisionEntity extends CollisionEntity {
public var marble:Marble;
var _dbgEntity:h3d.scene.Mesh;
var _dbgEntity2:h3d.scene.Mesh;
public function new(marble:Marble) {
super(cast marble);
@ -27,6 +28,7 @@ class SphereCollisionEntity extends CollisionEntity {
var boundingBox = new Bounds();
var pos = transform.getPosition();
boundingBox.addSpherePos(pos.x, pos.y, pos.z, radius);
boundingBox.transform3x3(transform);
this.boundingBox = boundingBox;
// if (_dbgEntity == null) {
@ -37,8 +39,21 @@ class SphereCollisionEntity extends CollisionEntity {
// _dbgEntity.material.mainPass.wireframe = true;
// _dbgEntity.setTransform(transform);
// MarbleGame.instance.scene.addChild(_dbgEntity);
// var cube2 = new h3d.prim.Cube(this.boundingBox.xSize, this.boundingBox.ySize, this.boundingBox.zSize, true);
// cube2.addNormals();
// cube2.addUVs();
// _dbgEntity2 = new h3d.scene.Mesh(cube2);
// _dbgEntity2.material.mainPass.wireframe = true;
// _dbgEntity2.setTransform(transform);
// MarbleGame.instance.scene.addChild(_dbgEntity2);
// } else {
// _dbgEntity.setTransform(transform);
// var cube2 = new h3d.prim.Cube(this.boundingBox.xSize, this.boundingBox.ySize, this.boundingBox.zSize, true);
// cube2.addNormals();
// cube2.addUVs();
// _dbgEntity2.primitive = cube2;
// _dbgEntity2.setPosition(pos.x, pos.y, pos.z);
// }
}