# Thread: Help with 3D-like collisions

1. ## Help with 3D-like collisions

So I'm trying to make convincing 3d like collisions in 2d, and I'm trying to do this by using detection boxes, one "front" of the object, and the other one "behind", and both have a respective collision box.

"If the player is colliding with collision-front while overlapping detection box-front, make the player stop"

The same with behind

But when the player collides with the "front" object while colliding with the "behind" object (like in the attatched picture, in the file you'll have to hold "d" or "a" in the same and similar positions to see this happening) it starts bouncing uncontrollably, and I don't know how to fix this, and I've been trying for months now.

The mfa file is the exact code I'm using in my game for you tou try it out and see what's the problem.

Please help me!
Thanks.

2. If that way of doing it is just simply wrong and can't be fixed, is there any way of doing it that actaully works?

3. I had looked at it - but I wasn't sure why it was a problem - as I see it the player walks into the wall, and then is bounced back to break the collision and then if he walks into the wall again - he is bounced back again and this repeats.

But in a game the player would most likely not continuously keep running into a wall (let's hope) so this won't happen. What am I missing?

What I could suggest is that you might be having a sequence where Fusion is executing collision 1 then collision 2 then collision 1 again - and you could write in a third collision for the instance where the player is overlapping both:

Collision 1 = player is overlapping block 1 and not block 2
Collision 2 = player is overlapping block 2 and not block 1
Collision 3 = player is overlapping block 1 & 2

4. I'll try that out and see if it works.

5. I was playing around with this - it's the shape of your character vs the hitbox that is causing the bouncing effect.

If I either exclude the hitbox from the collision event, or change the shape of your character (or turn off fine detection), the bouncing goes away.

The hitbox is slightly off centre - so your double collision event that says - the character & the hitbox must overlap isn't true until the hitbox reaches the target - at which point the player is well into the target as it extends beyond the hitbox - and is moved back. This is what you're seeing.

You'd probably have to make sure the hitbox is fully centre on the character and that the character's arms don't extend beyond it if you want to use both in a collision event.

6. I made the hitbox bigger and centered it, and made the arms be basically tied to the waist, but as soon as the head collides with "collisionfront" while the "hitbox" (it's not too much of a hitbox, more like a detection box for where the feet are) is overlapping the front detection box it bounces back.

And I can't remove the feet detection box as that would make what I'm trying to do literally impossible, as it's supposed to be a 3d object, so the when the feet collide with the "base" of the object the player stops, not when any part of the player collides with it, like the head.

I think this method with all the detection boxes is wrong and have to find a new one of making 3d-like collisions, but I literally have no more ideas. Is there a way I should do it?

7. Can you explain more what you're trying to do? For example are these 3d obstacles the player must walk around - or are they obstacles the player must push? What is the player doing? Simply walking around? Can you provide a screenshot of the actual 3D scene?

8. They're not obstacles, but things the player must use like terminals, buttons and cannons, and I want them to feel like actual things in the world, so walking through them is not an option, so I want the collisions to make sense in the way that if the player's feet collide with the "bottom" of the object it stops like a real body would.

And about the 3d scene screenshot I always work on the code first using placeholder art, so visually it's not much different to the mfa file I posted here, and functionally it's exactly the same.

If I record a video of a 3d game with collisions like the ones I want to do, would that help?

9. I use rendered images of 3d objects in my games - but even though they look 3D - they are 2D and the collisions are 2D based with the entire object - it's a transparent .png and with fine detection the player is only going to collide or be stopped by an actual part of the object.

Your game only has problems when you're doing a combined collision - the player and the hitbox simultaneously. I don't understand why that's necessary - so any picture or video to explain that part so I can see it, might help me, or someone else here, think of other ideas.

10. (I apologize for the horrid video quality) https://youtu.be/knrWjkSXysE

I can't make the whole object collideable, because if I do the player won't stop at the "base" of the object (like at the begining and end of the video) but as soon as it touches the object, like in 0:13 and 0:19

The "combined collision" thing was just me trying to replicate the correct collisions (like the ones at the start and end of the video), but I've completely given up on that method it as it's been proven it doesn't work, so now I'm just trying to find the right way of making these 3d type collisions.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•