Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
Is there a code snippet to turn off collision on an object dynamically while in game? was thinking something like this? ccbSetSceneNodeProperty(Node, 'Collision', false); |
||||
|
Hey CF Looking at https://www.ambiera.com/forum.php?t=2916 it seems there is no way of achieving this. Niko mentioned to use ccbSetSceneNodePositionWithoutCollision ccbSetSceneNodePositionWithoutCollision(sceneNode, x, y, z)
Sets a new position of a scene node, even if the scene node has a 'collide with walls' behavior attached to it. So it it possible to move such a scene node through walls. Note that you have to ensure that the new position of the scene node is not inside a wall, otherwise the node will be stuck. Examples: var s = ccbGetSceneNodeFromName("cubeMesh1"); ccbSetSceneNodePositionWithoutCollision(s, -22.097015, 9.848448, -40.738777); Makes a scene node change its position, independent of its collision behavior. |
||||
|
No, you can't do this currently but you can delete the collision object and move the collsion object somewhere else which can be a workaround. for that you can use the inbuilt action delete a scene node or just move the node somewhere else and then use this command ccbUpdatePhysicsGeometry() on every few seconds. this might help in most cases but if you simply want to disable the collision then no you can't do this another workaround is create 2 instances of your object one with collsiion adn another without collision and when you want to disable collision of a scenenode simply move the colliding object to somewhere else or delete it then only the noncolliding object will be there and no collision will occur. or maybe changing faces of the object might help as shows in the post mentioned by nrasool above all you need is use the ccbUpdatePhysicsGeometry() command otherwise it won't work. |
||||
|
Thank you nrasool and just_in_case! I will look into those options as soon as I can, I was looking for an easy way to turn it off but those options are fine. Thanks again for the reply! CF |
|