Box Collisions and Grabbing system?

This forum is currently in read-only mode.
From the Asset Store
Create complex dialogues with ease with this tool/template!
  • I have a 3D box which can be spawned by the player and when I have 2 boxes and spawn them right after another or near each other they spawn inside each other. How can I make it push it out a bit so they aren't colliding??

    I also want to be able to pick things up with the mouse. How can I do this. I have a system that sets the force towards the mouse when clicked and over the object. This however is buggy, since if I move fast it drops.

    Thanks in advance.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • For the overlapping:

    The first method to fix overlapping is to not spawn a box if the place it's spawning in is already occupied with a box. You could use an invisible detector object to check for it, so if the detector blips in and finds that there's already a box there, it'll just not spawn another.

    The second way to do it would be to pick one of the overlapped boxes and use a loop to move it 1 pixel away until it's no longer overlapping. You could try something like this:

    +While 
    +spriteBox overlaps spriteBox
    -Set spriteBox.X to (spriteBox.X-1)
    [/code:9brjfm87]
  • The 3Dbox doesn't have the overlapping option.

  • Ah, you know what? I totally missed the 3D part. Just skimmed right over it. Forget I said anything.

    The short story: The 3D Box doesn't have collision detection, at least not the kind you're probably thinking of. Don't use the 3D box as a game object. It's for display only.

    The long story: Okay, fine. You can use it as a game object, as long as you're clever about it. But I don't feel like typing the long story out (again). I've written up the 3D Box description a zillion times already.

    Oh what the hell, I'll dig up a link for you...

    Okay, here you go:

    http://scirra.com/phpBB2/viewtopic.php?p=1406#1406

    Anyway, if you want to do collision stuff with the 3D box, use a regular, invisible sprite as your collider. Perform all your game actions on the sprite instead of the box. Then just put in a "Always: 3DBox: Set position to object colliderSprite (image point 0)." Voil�. It looks just like you're manipulating a 3D Box directly, and nobody's the wiser.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)