vahith Posted February 4, 2015 Share Posted February 4, 2015 hi All;i am creating multiple mesh with drag and drop option its working fine but what i need is when i drag one mesh it should not collide with other meshes in scene. it should move to near or right or left or top of that mesh.how i can achieve that...this is the reference what i created..http://www.babylonjs-playground.com/#VMFNH#4 Quote Link to comment Share on other sites More sharing options...
amorgan Posted February 4, 2015 Share Posted February 4, 2015 http://www.babylonjs-playground.com/#VMFNH#5 note, use mesh.moveWithCollisions() and assigning ellispoid to the meshes Cool demo! vahith 1 Quote Link to comment Share on other sites More sharing options...
iiceman Posted February 4, 2015 Share Posted February 4, 2015 I don't have time to give you a playground at the moment but you could use collision check (http://doc.babylonjs.com/page.php?p=22101 - or with the actionManager: http://babylondoc.azurewebsites.net/page.php?p=22531) and then just calculate where the box should move when it intersect or maybe use moveWithCollisions (http://doc.babylonjs.com/page.php?p=22091) while moving it. Quote Link to comment Share on other sites More sharing options...
vahith Posted February 5, 2015 Author Share Posted February 5, 2015 hi amorgan; thanks for giving solution but i need one more how to apply diff color in 6 face.. and i want increase scaling dynamically is it possible.. Quote Link to comment Share on other sites More sharing options...
amorgan Posted February 6, 2015 Share Posted February 6, 2015 What are you trying to do specifically? On clicking and moving the mouse? Changing a specific faces color? Every mesh has a .scaling property, which you can then do a similiar action that you were trying originally when moving the object (ie mesh.scaling += 0.1; ). Though detecting collisions do not exist for scaling and rotating with a function like moveWithCollisions, that I am aware. Maybe do a intersect check and if it is with an object you want to collide with, then disable the scaling. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.