Hey, first time writing here, but I'll try to be as thorough as I can.
I'm just starting to learn coding, so I'm always trying out things and practicing things, following tutorials and such.
So I tried following this tutorial about physics and world callbacks, and I think I got it, but I, being a beginner after all wanted to extend on it, so I started adding walls and blocks and such.
Now here is where my issue begins. Everything seems to work fine, except whenever the player ends up in a corner the jumping is disabled. And yes, I have states so the player can only use jump when on the ground (or platform). And I have turned off jumping when jumping and sliding down the wall. But even when I didn't have jumping on wall disabled, the wall would always disable the collision with the ground.
I guess I typed a little more than necessary as the end seems to pretty much sum it up. The wall disables the ground collision when in corner.
Any solution?
Oh, also, I might add, you can use either Xbox 360 controller or keyboard to move.
Controller:
Hold X : Move faster
A : Jump
Left stick to move
Keyboard:
Left & Right arrow keys to move
Hold lshift : Move faster
Space : Jump
Thanks in advance.
Need help with collision detection issue
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Need help with collision detection issue
- Attachments
-
- gravitytest.love
- (1.2 KiB) Downloaded 126 times
- Chris
Re: Need help with collision detection issue
it seems it's a presolve() problem (but i'm a TOTAL noob at physics)
i putted that instead of your beginCollision()
and emptied your presolve() and it works fine
sorry for the english, test the love (i renamed some things shorter)
EDIT you must erase the line i add
cause it make no sense
i putted that instead of your beginCollision()
Code: Select all
local x, y = coll:getNormal()
text = a:getUserData() .. " is touching " .. b:getUserData() .. " at " .. x .. ", " .. y
if a:getUserData() == "Down"
or a:getUserData() == "Right"
or a:getUserData() == "Block"
or a:getUserData() == "Block2" then
jumpEnabled = true
end
sorry for the english, test the love (i renamed some things shorter)
EDIT you must erase the line i add
Code: Select all
or a:getUserData() == "Right"
- Attachments
-
- gravitytest2.love
- (1.11 KiB) Downloaded 116 times
Current work : Isömap
Re: Need help with collision detection issue
It did help with the issue when jumping while pressed against the wall, and also sliding down from wall to ground and jumping up again. But the collision to the ground still disappears if you just walk into the corner and out again without jumping.
Is there a better, yet somewhat easy way to do the jumping?
Oh, I like what you did to the coding btw, looks a lot cleaner, thanks.
EDIT: Is there maybe a way to make it look for a new collision when ending a collision? Like, forcing it to check if there is another collision?
Is there a better, yet somewhat easy way to do the jumping?
Oh, I like what you did to the coding btw, looks a lot cleaner, thanks.
EDIT: Is there maybe a way to make it look for a new collision when ending a collision? Like, forcing it to check if there is another collision?
- Chris
Who is online
Users browsing this forum: Bing [Bot] and 2 guests