WaveEngine 2.2.1 to 2.3 Cheat sheet

In the last WaveEngine 2.3.0 version has been added Box2D physics engine as native integration. It allows a lots of new physics features and a better performance but it brings many API changes.

WaveEditor has a Upgrader Tool that automatically upgrade your project files to last WaveEngine version but doesn’t modify your source code. So you can find some issues after upgrade your project.

This article brings you a list of common issues and how to solve them:

RigidBody and Colliders

WaveEngine 2.2.1

[code language=”csharp”]
new RigidBody2D()
{
PhysicBodyType = PhysicBodyType.Static
});
[/code]

WaveEngine 2.3.0

[code language=”csharp”]
new RigidBody2D()
{
PhysicBodyType = RigidBodyType2D.Static
});
[/code]

WaveEngine 2.2.1

[code language=”csharp”]
new RigidBody2D()
{
EnableContinuousContact = true,
};
[/code]

WaveEngine 2.3.0

[code language=”csharp”]
new RigidBody2D()
{
IsBullet = true,
};
[/code]

WaveEngine 2.2.1

[code language=”csharp”]
this.RigidBody.Rotation = 0;
[/code]

WaveEngine 2.3.0

[code language=”csharp”]
this.RigidBody.Transform2D.Rotation = 0;
[/code]

WaveEngine 2.2.1

[code language=”csharp”]
.AddComponent(new RectangleCollider2D())
.AddComponent(new RigidBody2D()
{
Mass = 0.003f
});
[/code]

WaveEngine 2.3.0

[code language=”csharp”]
.AddComponent(new RectangleCollider2D()
{
Density = 0.003f,
})
.AddComponent(new RigidBody2D());
[/code]

WaveEngine 2.2.1

[code language=”csharp”]
.AddComponent(new PerPixelCollider2D(
WaveContent.Assets.asteroid_png, 0)
)
[/code]

WaveEngine 2.3.0

[code language=”csharp”]
.AddComponent(new PolygonCollider2D()
{
TexturePath = WaveContent.Assets.asteroid_png,
Threshold = 0,
})
[/code]

Forces, Impulses

WaveEngine 2.2.1

[code language=”csharp”]
this.RigidBody.ApplyLinearImpulse(Vector2.UnitX);
[/code]

WaveEngine 2.3.0

[code language=”csharp”]
this.RigidBody.ApplyLinearImpulse(Vector2.UnitX,
this.RigidBody.Transform2D.Position);
[/code]

WaveEngine 2.2.1

[code language=”csharp”]
rigidBody.ApplyAngularImpulse(this.angularImpulse);
[/code]

WaveEngine 2.3.0

[code language=”csharp”]
rigidBody.ApplyTorque(this.angularImpulse);
[/code]

 Joints

WaveEngine 2.2.1

[code language=”csharp”]
mouseJoint = new FixedMouseJoint2D(this.touchPosition);
this.connectedEntity.FindComponent<JointMap2D>()
.AddJoint("mouseJoint", this.mouseJoint);
[/code]

WaveEngine 2.3.0

[code language=”csharp”]
mouseJoint = new MouseJoint2D()
{
Target = this.touchPosition,
};
this.connectedEntity.AddComponent(this.mouseJoint);
[/code]

WaveEngine 2.2.1

[code language=”csharp”]
this.mouseJoint.WorldAnchor = this.touchPosition;
[/code]

WaveEngine 2.3.0

[code language=”csharp”]
this.mouseJoint.Target = this.touchPosition;
[/code]

WaveEngine 2.2.1

[code language=”csharp”]
new FixedJoint2D(connectedEntity);
[/code]

WaveEngine 2.3.0

[code language=”csharp”]
new WeldJoint2D()
{
ConnectedEntityPath = connectedEntity.EntityPath,
};
[/code]

WaveEngine 2.2.1

[code language=”csharp”]
new AngleJoint2D();
[/code]

WaveEngine 2.3.0

[code language=”csharp”]
//No longer supported
[/code]

 Physics Events

WaveEngine 2.2.1

[code language=”csharp”]
rigidBody.OnPhysic2DCollision += OnPhysic2DCollision;
rigidBody.OnPhysic2DSeparation += OnPhysic2DSeparation;
[/code]

WaveEngine 2.3.0

[code language=”csharp”]
collider.BeginCollision += Collider_BeginCollision;
collider.EndCollision += Collider_EndCollision;
[/code]

 

Published by

Jorge Canton

He is an engineer in computer science, #WaveEngine team member is a technology enthusiast determined to stay on the cutting edge of development. He is a very dynamic person who loves solving challenges, puzzles and riddles. He usually spends his free time with his family or playing videogames on his console or mobile phone and plays the piano to relax.

Leave a Reply

Your email address will not be published. Required fields are marked *