setSensor bug

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
solsword
Prole
Posts: 9
Joined: Sun Mar 29, 2009 8:24 am
Location: Claremont, CA
Contact:

setSensor bug

Post by solsword »

I'm working on a quick prototype for a 2d combat system in löve, and I'm trying to use a Shape with the sensor property (by calling, for example, hitbox:setSensor(true)) as a hit area for an attack. I want to quickly create the sensor shape when the attack is executed and then destroy it after one timestep, during which I check for collisions in my collision callback function and handle things appropriately. However, the setSensor function doesn't seem to be working properly... the sensor shape interacts physically with any objects that are touching it when it is created, until they no longer touch it. After that point, it behaves like a sensor should according to the Box2D documentation (i.e. collisions with the sensor don't result in any physics events). The problem is, even though it exists for just 1 timestep, this erroneous collision handling causes about a half-pixel's worth of knockback when it intersects an enemy (or wall, for that matter, since I'm attaching the attack Shape to the player's Body).

I plan to work around the issue by creating the sensor as a permanent object and just changing it's size to stick it inside the player's normal Shape when not in use, but I thought that it would be good to address this issue if it is a bug in löve.
-=[ solsword ]=-

My favorite games: http://www.cs.hmc.edu/~pmawhorter/games.html
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 88 guests