@joedono:
Found the problem. It was a faulty implementation of "cross". It was not supposed to "move the item around", but it was moving it when doing the collision resolution. In your case it would mean that the item was "pushed away by the blocks" until it stopped colliding with them (that's why you got those straight lines).
I have fixed the bug and released 3.0.1. If you redownload it again from github, it should work now.
Again, thanks for your help resolving this.
[library] bump.lua v3.1.4 - Collision Detection
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: [library] bump.lua v3.0 - Collision Detection
When I write def I mean function.
Re: [library] bump.lua v3.0.1 - Collision Detection
Super cool! Glad to help. Going to be using this in my next project.
Re: [library] bump.lua v3.0.1 - Collision Detection
hey kikito, how can i get item colliding instead of other?
i keep all my entities in a table, because of that my filter function changes the values of all the items in the entity table instead of just that one that is colliding
i keep all my entities in a table, because of that my filter function changes the values of all the items in the entity table instead of just that one that is colliding
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: [library] bump.lua v3.0.1 - Collision Detection
Hi there,Doctory wrote:hey kikito, how can i get item colliding instead of other?
i keep all my entities in a table, because of that my filter function changes the values of all the items in the entity table instead of just that one that is colliding
You can see an example of this in the grenades of simpledemo. Each grenade has its own filter, so the filter can reference "self" (the grenade).
So if you need to use "item" in the filter itself, you have to create a separate filter for each entity that needs it. This usually means that you'll create the filter when you create the entity itself.
The reason why filter can not depend on item is kind of complicated. In short, it is this: the detection phase uses 4 coordinates which change gradually while the resolution happens - but this must be done without changing the coordinates of the item being collided. So the item is never passed around.
I realize that it is a bit weird not having the item there somewhere. I will see if I can find a way to put it as an extra parameter, but I can make no promises on that.
When I write def I mean function.
- Jasoco
- Inner party member
- Posts: 3726
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: [library] bump.lua v3.0.1 - Collision Detection
How exactly would one make a moving platform? i.e. one that a player or other character would stand on, and move with it, but retain the ability to walk and jump off of it.
I have horizontally moving ones working fine it seems. (Well not really. The platform moves one frame before the player moves so they're always out of sync.) But vertical ones don't work. Not sure exactly how to tackle it.
I have horizontally moving ones working fine it seems. (Well not really. The platform moves one frame before the player moves so they're always out of sync.) But vertical ones don't work. Not sure exactly how to tackle it.
Re: [library] bump.lua v3.0.1 - Collision Detection
When doing player collision, check all things colliding with the foot "mesh" for being platforms, then store the player in "platform.players" or the platform in "player.standingOn", then in platform:update or player:update, whichever gets updated first in your update loop, move or be moved correspondingly?Jasoco wrote:How exactly would one make a moving platform? i.e. one that a player or other character would stand on, and move with it, but retain the ability to walk and jump off of it.
I have horizontally moving ones working fine it seems. (Well not really. The platform moves one frame before the player moves so they're always out of sync.) But vertical ones don't work. Not sure exactly how to tackle it.
Re: [library] bump.lua v3.0.1 - Collision Detection
When doing player collision, check all things colliding with the foot "mesh" for being platforms, then store the player in "platform.players" or the platform in "player.standingOn", then in platform:update or player:update, whichever gets updated first in your update loop, move or be moved correspondingly?Jasoco wrote:How exactly would one make a moving platform? i.e. one that a player or other character would stand on, and move with it, but retain the ability to walk and jump off of it.
I have horizontally moving ones working fine it seems. (Well not really. The platform moves one frame before the player moves so they're always out of sync.) But vertical ones don't work. Not sure exactly how to tackle it.
And ofc just set y pos... when the player jumps you could add the platform to an ignore list for a few frames just in case.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: [library] bump.lua v3.0.1 - Collision Detection
Hi there,
I would do them like this:
Update the platforms before updating the player (that makes things a bit easier).
When a player collides with a platform:
I will try to do an example tomorrow - today I am a bit busy I'm afraid.
I would do them like this:
Update the platforms before updating the player (that makes things a bit easier).
When a player collides with a platform:
- If the collision normal is not "up", do a normal collision (I assume that pass-through platforms are properly filtered)
- If the collision is "up", then displace the player with dx = platform.vx * dt, and dy = platform.vy * dt
I will try to do an example tomorrow - today I am a bit busy I'm afraid.
When I write def I mean function.
- Jasoco
- Inner party member
- Posts: 3726
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: [library] bump.lua v3.0.1 - Collision Detection
No problem. If you want me to provide my current code I can. I've ported it mostly to 3.0 and it is back to working just like it was pretty much. I'll keep playing around. I have some ideas. I just want to make sure I do it properly.
Edit: I did it! At least it looks like I did.
Basically I made a separate callback in the player object called "moveWithPlatform" that accepts the vx and vy of the platform. When the player is standing on a platform it gets a "attachedToPlatform" string that refers to the platform in question. Then in that platform's object, it checks to see if the player is attached to it and if so it calls the "moveWithPlatform" callback for the player which uses Bump's collision callbacks to make sure it handles collisions the same way the player would by itself.
I will modify it to also move other stuff standing on it too.
Edit: I did it! At least it looks like I did.
Basically I made a separate callback in the player object called "moveWithPlatform" that accepts the vx and vy of the platform. When the player is standing on a platform it gets a "attachedToPlatform" string that refers to the platform in question. Then in that platform's object, it checks to see if the player is attached to it and if so it calls the "moveWithPlatform" callback for the player which uses Bump's collision callbacks to make sure it handles collisions the same way the player would by itself.
I will modify it to also move other stuff standing on it too.
Who is online
Users browsing this forum: No registered users and 1 guest