ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperLicht
forum topic indicator Animator problems
person icon
dennissangmo
Registered User
Quote
2010-09-27 18:22:23

Hi
I have created a new class like in tutorial 3 http://www.ambiera.com/copperlic...

I simply want to be able to run a JS function when that object is clicked.

I added a new property function to the class which is called from the construktor:
LinkSceneNode.prototype.activateLink = function(engine, scene){
var thefunction = function() { alert('Oh, I am clicked!'); }
this.addAnimator(new Animator0nClick(scene, engine, thefunction));
}

Where the '0' is an 'O'... Some sort of bug with '0nclick' phrase on this forum, see here -> "" <-.

("LinkSceneNode" is my classname instead of "MySceneNode" in the tut)

When i'm debugging it in my webbrowser i can see that 'this' is pointing to the right SceneNode.

My result is that nothing happens when i click on my sceneNode in WebGL. is there something i missed in the code or any information.


[edit] the topic is bugged aswell. It's suppose to say 'Animator0nClick' with and 'O'

person icon
niko
Moderator
Quote
2010-09-27 18:42:39

Is the bounding box of your scene node correct? If it is not a mesh node, the animator tries to use the bounding box to calculate if your node has been hit.

person icon
dennissangmo
Registered User
Quote
2010-09-28 11:56:10

aha, ok...

The first thing i did when i tried to solve this was, changing the parent to "MeshSceneNode" instead of only "SceneNode". Then i'll use its "getBoundingBox()" method and its "Box" property.

My big problem was how to know or how to calculate the bounding box... I found a method in the "MeshBuffer" object named "recalculateBoundingBox()", which i called. Then i tried to use the buffert "Box3d" object in my "MeshSceneNode". But as i expected this didnt work.

Maybe im totaly off here, but i really want this to work in my schoolproject!

person icon
dennissangmo
Registered User
Quote
2010-09-28 13:43:44

NVM, i got it working when i did as i said in the prev post... The error that i thought was related to the boudning box had nothing to do with it...

And when i fixed that error the click event works... :D

thx for fast support.

person icon
niko
Moderator
Quote
2010-09-28 22:13:58

Ah, nice to hear :)


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |