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

  
new RigidBody2D() 
{ 
      PhysicBodyType = PhysicBodyType.Static 
});

WaveEngine 2.3.0

  
new RigidBody2D() 
{ 
      PhysicBodyType = RigidBodyType2D.Static
});

WaveEngine 2.2.1

  
new RigidBody2D()
{
      EnableContinuousContact = true,
};

WaveEngine 2.3.0

  
new RigidBody2D()
{
      IsBullet = true,
};

WaveEngine 2.2.1

  
this.RigidBody.Rotation = 0;

WaveEngine 2.3.0

  
this.RigidBody.Transform2D.Rotation = 0;

WaveEngine 2.2.1

  
.AddComponent(new RectangleCollider2D())
.AddComponent(new RigidBody2D()
{
      Mass = 0.003f
});

WaveEngine 2.3.0

  
.AddComponent(new RectangleCollider2D()
{
      Density = 0.003f,
})
.AddComponent(new RigidBody2D());

WaveEngine 2.2.1

  
.AddComponent(new PerPixelCollider2D(
      WaveContent.Assets.asteroid_png, 0)
)

WaveEngine 2.3.0

  
.AddComponent(new PolygonCollider2D()
{
      TexturePath = WaveContent.Assets.asteroid_png,
      Threshold = 0,
})

Forces, Impulses

WaveEngine 2.2.1

  
this.RigidBody.ApplyLinearImpulse(Vector2.UnitX);

WaveEngine 2.3.0

  
this.RigidBody.ApplyLinearImpulse(Vector2.UnitX,
this.RigidBody.Transform2D.Position);

WaveEngine 2.2.1

  
rigidBody.ApplyAngularImpulse(this.angularImpulse);

WaveEngine 2.3.0

  
rigidBody.ApplyTorque(this.angularImpulse);

 Joints

WaveEngine 2.2.1

  
mouseJoint = new FixedMouseJoint2D(this.touchPosition);
this.connectedEntity.FindComponent<JointMap2D>()
       .AddJoint("mouseJoint", this.mouseJoint);

WaveEngine 2.3.0

  
mouseJoint = new MouseJoint2D()
{
      Target = this.touchPosition,
};
this.connectedEntity.AddComponent(this.mouseJoint); 

WaveEngine 2.2.1

  
this.mouseJoint.WorldAnchor = this.touchPosition;

WaveEngine 2.3.0

  
this.mouseJoint.Target = this.touchPosition;

WaveEngine 2.2.1

  
new FixedJoint2D(connectedEntity);

WaveEngine 2.3.0

  
new WeldJoint2D()
{
      ConnectedEntityPath = connectedEntity.EntityPath,
};

WaveEngine 2.2.1

  
new AngleJoint2D();

WaveEngine 2.3.0

  
//No longer supported

 Physics Events

WaveEngine 2.2.1

  
rigidBody.OnPhysic2DCollision += OnPhysic2DCollision;
rigidBody.OnPhysic2DSeparation += OnPhysic2DSeparation;

WaveEngine 2.3.0

  
collider.BeginCollision += Collider_BeginCollision;
collider.EndCollision += Collider_EndCollision;

 

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 *