We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

collision detection

Home Forums Programming collision detection

Tagged: 

  • This topic has 11 replies, 3 voices, and was last updated 1 year ago by kdv.
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #61811
    bigmike814
    Customer

    Hello,

    I’m working with the collision detection in the physics puzzle and have come across an issue that I know can be resolved, but I’m not sure of the best way to go about it.

    The first issue is the collision detection library is storing my object positions in the wrong way. It has y as z and also inverse.

    The other issue is that it seems to be set for a 2m x 2m cube. I am able to fix this by going in and adjusting the code in the visual_logic.js file, but I will need to use it on more than just one size, so just changing the cube won’t resolve my issue.

    // do not allow empty-sized shapes
    size.x = size.x || 0.5;
    size.y = size.y || 0.5;
    size.z = size.z || 0.5;

    if (shape == ‘BOX’) {
    var geometry = new Ammo.btBoxShape(new Ammo.btVector3(
    size.x * 0.5, size.y * .65, size.z * .9));
    } else if (shape == ‘CAPSULE’)

    It looks like the Arcade Racing game was able to assign the items and then give each item a unique size.

    // Vehicle contants

    var chassisWidth = 1.0;
    var chassisHeight = 0.4;
    var chassisLength = 3.6;
    var massVehicle = 800;

    But there is more going on here than what I need and am not sure on how to set it up for just the ghost collision detection.

    Here is the issue I am having. To see the issue, point the move the building to view the right wall (brown wall) and open the doors/window accordion and click the add window button (no need to select a size).

    https://v3d.net/fni

    I’m having issues uploading to the website. Will post it when I get it uploaded if it is needed.

    Thanks in advance!

    #61812
    kdv
    Participant

    The first issue is the collision detection library is storing my object positions in the wrong way. It has y as z and also inverse.

    It’s not an issue. The native coordinate system for THREE.js/V3D.js is Y-Up-Right

    The rest is hard to get what are talking about. Even with the example…

    Puzzles and JS. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of meaning at all.

    #61814
    bigmike814
    Customer

    I had a feeling it had something to do with that.

    You can see that the collision isn’t detected when the rectangles actually collide. If I’m using 2×2 cubes they will detect precisely on impact. It looks like the collision detection is set at a 2m X 2m cube rather than the actual size of the box.

    I can fix this by declaring the dimensions I need in the visual_logic.js script, but it’s a pain to have to do this every time I update the puzzles. It looks like they added exec code into the puzzle for the Arcade Racing that allowed them to set the size of the chassis and other items.

    #61815
    kdv
    Participant

    It looks like the collision detection is set at a 2m X 2m cube rather than the actual size of the box.

    No.
    https://v3d.net/g2o

    Puzzles and JS. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of meaning at all.

    #61816
    bigmike814
    Customer

    this is using the physics puzzle? or that bounding box?

    Maybe it’s because my coordinates are set wrong. I’ll have to set my blender to Y up and test again.

    #61817
    kdv
    Participant

    this is using the physics puzzle?

    Yes
    BBoxes are here https://v3d.net/g15

    I’ll have to set my blender to Y up and test again.

    There is no need to do it.

    Puzzles and JS. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of meaning at all.

    #61818
    bigmike814
    Customer

    this might better show the issue I’m running into. I tried setting the Y up and rotating it and it still isn’t working.

    https://v3d.net/i5n

    #61819
    kdv
    Participant

    Perhaps, your problem is in scaling or morphing, but definitely not in coordinate systems.

    Puzzles and JS. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of meaning at all.

    #61820
    bigmike814
    Customer

    can you send that to me so I can see what I am doing wrong?

    #61830

    Hi, the are two things you should pay attention when using physics:

    1) In JavaScript the coordinate system is different. Contrary to Blender/Max Y axis looks Up, not Z. See here for more info.

    2) You should always apply scaling to all physics objects in the modelling suite.

    Soft8Soft Tech Chief
    X | FB | LinkedIn

    #61845
    bigmike814
    Customer

    Thanks Alex and KDV! You guys are a big help.

    This works for everything that is box shaped, but I do have a couple items that will be rectangle. Is there a way to set the scale on that without dipping into the visual_logic script? I can make it work if it is too complicated by calling those objects a capsule or other item and assigning the proper scale in the visual_logic when I’m ready to go live, but just wondering.

    #61846
    kdv
    Participant

    A box doesn’t mean a cube. It works with rectangular boxes too. And with meshes, and other shapes. Otherwise the simulation wouldn’t work.

    Puzzles and JS. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of meaning at all.

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.