Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
Hello again, I am having problems with something I expected to be very easy... mesh click events.. I have tried all animators, all selectors and I have read every single post about events... The most success I had was with this code: Casa1Out.Selector.getCollisionPointWithLine(startLine, endLine, true, null,true); However (I need various objects with similar click behaviour behind this one) when I click on this one object all objects with this behaviour behind it get the click event.. All I would need is for the endLine to actually end the line at the place I clicked in 3D on the canvas but this does not seem to be the case with my code. As this event is pretty important to me (duh!), I will need this to work somehow.. Here is my code: canvas. = function(event){ I could not use getTransformedBoundingBox() as this would always overlap with the other nodes (the nodes are walls) As you can see I have multiple meshes in my scene and all of them are overimposed (they are walls of a house). I am on a trial version of CopperCube now, if this is not possible I won't be buying this software and unfortunately I won't be using copperlicht... I am surprised how complicated it is to get an event from one node (with the node name returned)! and I don't seem to be the only one... this problem goes back from the start of CopperLicht... I suggest you do a tutorial for simple events with copperlicht that give back the object name that has been clicked (in a scene with multiple overlapping meshes, as they usually are) Thanks in advance for any help you may be able to provide, or even better samples. Daniel Bowyer Director at RighTwist |
||||
|
Hi, if you are using CopperCube (the editor), then you can use the most easy way to do this: Add a "when clicked do something" behavior to the object. That's it. If you prefer to do this in code using the CopperLicht SDK, then this also works, of course. Your code is correct, it only misses a check if there is another object between you and the point on the object you clicked on. So it should work like this, extending your code:
Note: this only works with the copperlicht.js from the copperlicht SDK, the one generated by the coppercube editor might for example not have the CollisionWorld variable defined. |
||||
|
Niko you are awesome!!! By the way, just for reference, there is no mention of the class CollisionWorld anywhere online or within the documentation attached to the latest SDK. Thanks so much! This is was a make or break problem, I am glad it is sorted Daniel |
|