1 decade ago by Dejan
After scaling an entity there seems to be some problems with the position of the collision box.
I'm scaling the entity in it's draw function like this:
this.random usally is simply a variable for a random number but in this case let's say it's 1.5.
While the unscaled entity would normaly work like this https://dl.dropboxusercontent.com/u/51029492/1.png
The scaled one will stand under the actual collision map.
https://dl.dropboxusercontent.com/u/51029492/2.png
While the Debug Mode is showing the collisionbox is at it's normal place it actually doesn't seem so.
So does anybody knows this problem and/or could tell me how to fix it (without simply changing the offset of the collisionbox)?
I'm scaling the entity in it's draw function like this:
draw: function() { ig.system.context.save(); ig.system.context.scale( this.random, this.random ); this.parent(); ig.system.context.restore(); },
this.random usally is simply a variable for a random number but in this case let's say it's 1.5.
While the unscaled entity would normaly work like this https://dl.dropboxusercontent.com/u/51029492/1.png
The scaled one will stand under the actual collision map.
https://dl.dropboxusercontent.com/u/51029492/2.png
While the Debug Mode is showing the collisionbox is at it's normal place it actually doesn't seem so.
So does anybody knows this problem and/or could tell me how to fix it (without simply changing the offset of the collisionbox)?