Hello,
I am new to playCanvas (and 3D) so forgive me for this silly question.
In flash (or canvas) we have objects with unique id and we set events (click, touch etc) by writing something like this:-
this.btn1.addEventListener("click", fl_BtnHandler1.bind(this));
function fl_BtnHandler1() {
//your action here
}
I have a scene where when we click on individual plane or cube some event happens.
link
I found out this link but this is not working.
can anybody please help me here.
Thanks.
max
May 8, 2017, 11:35am
#2
You have to post the project link, not published build link.
It is very likely that camera script that does orbiting prevents mouse events from propagating.
This is editor link (I think ).
https://playcanvas.com/editor/scene/519694
I have disabled all other script and tried; but it was still not working.
max
May 8, 2017, 12:49pm
#4
Scripts youâve copied are legacy script system, and not what you want. Here is tutorial project that you should use: http://developer.playcanvas.com/en/tutorials/entity-picking/
There are also quite a few other tutorial samples about picking objects here: http://developer.playcanvas.com/en/tutorials/?tags=raycast
1 Like
Thanks for quick reply. The new scripts working fine.
Another question, is there any option for giving ids to object and then referencing them in the scripts.
Basically I need is to click a âbuttonâ and another object become visible/invisible.
max
May 9, 2017, 11:17am
#7
Use Script Attributes with type âentityâ: http://developer.playcanvas.com/en/user-manual/scripting/script-attributes/
Please feel free to use http://developer.playcanvas.com/en/ a lot, as it has loads of useful info and learning material. It is faster to look and learn yourself than wait for others to answer your questions. And learning - is essential skill for developer.