Commit 1dbf9bc8 authored by Viktor Lidholt's avatar Viktor Lidholt

Fixes issue in sprite node

parent 5a481ed5
...@@ -260,12 +260,14 @@ class Node { ...@@ -260,12 +260,14 @@ class Node {
void teleportPosition(Point position) { void teleportPosition(Point position) {
assert(position != null); assert(position != null);
PhysicsWorld world = _physicsWorld(parent);
if (_physicsBody != null && (parent is PhysicsWorld || parent is PhysicsGroup)) { if (_physicsBody != null && (parent is PhysicsWorld || parent is PhysicsGroup)) {
position = _positionToPhysics(position, parent); position = _positionToPhysics(position, parent);
_physicsBody._body.setTransform( _physicsBody._body.setTransform(
new Vector2( new Vector2(
position.x / physicsNode.b2WorldToNodeConversionFactor, position.x / world.b2WorldToNodeConversionFactor,
position.y / physicsNode.b2WorldToNodeConversionFactor position.y / world.b2WorldToNodeConversionFactor
), ),
_physicsBody._body.getAngle() _physicsBody._body.getAngle()
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment