Moving object by picking

Morrigan

11-02-2010 10:14:45

Hello,

I try to do a application where it's possible to place many items in a room (with collision between object, ground, wall, ...)
I place my items in my scene with setGlobalPosition() in function of the position of my mouse (I use picking on the ground and the physxitems follow my mouse).

I have a problem when I move my items with my mouse and that my items enter in collision with a other object (wall or other object).
In fact with setGlobalPosition() and my picking, when i move my items, my object move IN a other object and so the physic push the two object ...
If I move a chair in a wall with my system, the chair is project. I would like my chair is just block by the wall.
And if the second object is a second chair, I would like my first chair push my second chair (and don't eject the two chair).

I tried some possibility (sleep object when detect a collision, some flags to control the response) but I don't the correct way.
Do you have any solutions to help me ?

Sorry for my english.
Thank.

betajaen

11-02-2010 14:24:45

You'd have to perform a volume test to see if your picking object will collide with something before you finish picking, if does then don't allow the object to be placed there.

Have a look at the sweeping functions in Detritus.

LucaMoller

13-02-2010 17:29:52

I think the big problem is with the setGlobalPosition(), maybe you should try to add some speed to your object in a way it follow your mouse, by doing this it wouldn't go inside walls, wouldnt have "explosion" collisions and if the chair you are pushing collides with other chair they would collide just fine I think :wink:. the direction of the speed would be the vector from the object to the mouse, the intensity could be proportional to this vector's lenght (you could use linear, quadractic or something else proportion, just what becomes better in your app). The problem is that the object wouldn't be exactly together with the mouse, the result could sound like a lag.