mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 08:02:39 +08:00
remove unneeded codes (#16585)
This commit is contained in:
@@ -37,7 +37,7 @@ import { B2Joint } from './joints/joint-2d';
|
||||
|
||||
const tempVec3 = new Vec3();
|
||||
const tempVec2_1 = { x: 0, y: 0 };//new B2.Vec2(0, 0);
|
||||
let tempVec2_2 = { x: 0, y: 0 };
|
||||
const tempVec2_2 = { x: 0, y: 0 };
|
||||
export class B2RigidBody2D implements IRigidBody2D {
|
||||
get impl (): B2.Body | null {
|
||||
return this._body;
|
||||
@@ -182,19 +182,10 @@ export class B2RigidBody2D implements IRigidBody2D {
|
||||
if (!b2body) return;
|
||||
|
||||
const pos = this._rigidBody.node.worldPosition;
|
||||
|
||||
//the belowing code seems useless?
|
||||
const bodyType = this._rigidBody.type;
|
||||
if (bodyType === ERigidBody2DType.Animated) {
|
||||
tempVec2_2 = b2body.GetLinearVelocity();
|
||||
} else {
|
||||
tempVec2_2 = b2body.GetPosition();
|
||||
}
|
||||
|
||||
tempVec2_2.x = pos.x / PHYSICS_2D_PTM_RATIO;
|
||||
tempVec2_2.y = pos.y / PHYSICS_2D_PTM_RATIO;
|
||||
|
||||
if (bodyType === ERigidBody2DType.Animated && enableAnimated) {
|
||||
if (this._rigidBody.type === ERigidBody2DType.Animated && enableAnimated) {
|
||||
this._animatedPos.set(tempVec2_2.x, tempVec2_2.y);
|
||||
} else {
|
||||
b2body.SetTransform(tempVec2_2, b2body.GetAngle());
|
||||
|
||||
Reference in New Issue
Block a user