碰撞系统重做

This commit is contained in:
2024-08-22 10:57:23 +08:00
parent ceee58079d
commit a707bcca29
7 changed files with 183 additions and 316 deletions

View File

@@ -24,15 +24,13 @@ export class SkillCom extends CCComp {
angle:number = 0;
t_pos:Vec3 = null;
is_destroy:boolean = false;
box_group:number = 0;
start() {
this.node.active=true
this.node.angle = this.angle;
//根据目标坐标、欧拉角、预设距离增量speed 来计算新的x增量y增量
// this.x_speed = Math.cos(this.angle * Math.PI / 180) * this.speed;
// this.y_speed = Math.sin(this.angle * Math.PI / 180) * this.speed;
let collider = this.getComponent(Collider2D);
collider.group = this.box_group;
if (collider) {
// collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);
@@ -86,11 +84,7 @@ export class SkillCom extends CCComp {
}
change_collider_group(group:number){
let collider = this.getComponent(Collider2D);
collider.group = group;
}
update(deltaTime: number) {
update(deltaTime: number) {
// this.node.setScale(v3(this.scale,this.node.scale.y,this.node.scale.z))
this.move(deltaTime)
// if(Math.abs(this.node.position.x) > this.dis)