VittorioSL

Members
  • Content Count

    12
  • Joined

  • Last visited

  1. VittorioSL

    Box2D and Sprite Position

    I have a problem with relocating a sprite in the game. In practice dragging an object, if this collides with another, I'd like it to position it with certain coordinates. I use Box2D physic. When sprite collides with another I set its coordinates in this way: sprite.body.x = 100; sprite.body.y = 100; but when I reclick on the object this, in a first moment, appears with coordinates 100,100 and then returns to the coordinates at the time of the collision. Can anybody help me? I've been struggling with this problem for several days and I can not find a solution! Thanks in advance, Vittorio
  2. VittorioSL

    Scale Polygon

    Hi all, I've a problem with Phaser and Box2D Physic. I created a game where I load sprites and apply a polygonal body to them through a series of coordinates. When I resize the sprite I send the coordinates to a function that recalculates them based on the scaling factor. The coordinate array returned to me is correct, but when I redraw the body I have the effect shown in the attachment image. In other words, a square is always drawn in the same position and with the same dimensions. The coordinates of the square AREN'T present in my array. I realized that this occurs when there are very close coordinates 'cause if the scaling factor isn't so small the problem doesn't occur. Can someone help me? Thanks in advance, Vittorio
  3. VittorioSL

    Box2D and Sensors

    Hi all, I created a game using box2d physics. Inside there are many sprite whose bodies collide with each other. Each sprite also has 4 sensors. Is there a way to check the overlap between two sensors and eventually create a joint between the two sprites? Thanks for support, Vittorio
  4. VittorioSL

    P2 Physics and Collision

    Hi all, I'm newbie on Phaser and I'm looking for a way to detect the collision between two or more polygons. I understood that I must use P2 Physics but I'd like to stop polygons and not apply any physical effect (as in the one-way collision). Can anybody help me? Thanks in advance, Vittorio
  5. VittorioSL

    Babylon.js + Cannon.js - Check only collision

    Hi @Wingnut , I've updated test4. Now you can see BoundingBox. All meshes have CheckCollision property set as true. Despite this collision works well between object with same size. Instead an object with small boundingBox overlaps an object with biggest boundingBox. For example you can try selecting a (Wally -> Wally 710) and dragging it on a (Sitty -> Divano). Thanks for support
  6. VittorioSL

    Babylon.js + Cannon.js - Check only collision

    http://test4.studioleonardo.com:81/ This is an example using moveWithCollision and Ellipsoid. If you move a small object on a biggest one you'll see a overlapping problem. Also rotating the object (press shift and move mouse) in this solution you continue to have problem of visualization with overlapped objects.
  7. VittorioSL

    Babylon.js + Cannon.js - Check only collision

    Hi @Wingnut, in your PG if I set two barrels with different sizes I've a overlapping problem. In my example (http://test1.studioleonardo.com:81) I use Cannon.js Physics engine and I haven't overlapping problem but on collision objects move independently. Do you know a way to stop this effects? Thanks
  8. VittorioSL

    Babylon.js + Cannon.js - Check only collision

    Hi @syed samoon link works. Select from left dropdowns an object. For example Sitty -> Divano Move it then dispose another object Sitty -> Poltrona. Then try to collide them. This is the problem that occure using Cannon.js and Physics Impostor. Thanks
  9. VittorioSL

    Babylon.js + Cannon.js - Check only collision

    Hi @syed samoon, I need the objects not to overlap. I tried to save the last useful position of the object I'm moving and in case of overlapping, I reposition the object but it does not work. With Cannon.js I can intercept the collision but the objects move in space. This is the example: http://test1.studioleonardo.com:81 Thanks in advance, Vittorio
  10. Hello, can someone help me? I'm developing an application with Babylon.js and Cannon.js and I need to check only the collision between two objects (imported from blend obj) without generating any movement of them. The two objects should also be magnetic. This is the code that I'm using in this moment: var selectedObject = selectedMesh.parent; selectedObject.moveWithCollisions(diff); for (i = 0; i < arrayParentMeshes.length; i++) { var checkElement = arrayParentMeshes[i];selectedObject.physicsImpostor.registerOnPhysicsCollide(checkElement.physicsImpostor, function (main, collided) {console.log('COLLIDED');}); } Thanks in advance
  11. VittorioSL

    Add objects runtime

    Hello to all, I illustrate my scenario. I need to add dynamically to the scene objects in obj format selected by dropdowns and to be able to change the texture from time to time. Any suggestions? Thanks for now, Vittorio