Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperLicht
Question about AnimatorOnProximity

qch
Registered User
Quote
2011-05-20 15:00:57

i want do something when mesh2 get close to mesh1,my code as follow:
engine.ingComplete = function()
{
var scene = engine.getScene();
if (scene)
{
// find the cube scene node
cubeSceneNode = scene.getSceneNodeFromName('cubeMesh2');

var cm1 = scene.getSceneNodeFromName('cubeMesh1');

var testf = function (){
alert("aaaaaaaaaaa");
}
var animator1 = new CL3D.AnimatorOnProximity(scene,150,cubeSceneNode.Id,testf,false);
cm1.addAnimator(animator1);

// also, force the 3d engine to update the scene every frame
scene.setRedrawMode(CL3D.Scene.REDRAW_EVERY_FRAME);

}
}


but,it did not work. i want to know why and a well working example. thanks a lot.


niko
Moderator
Quote
2011-05-22 21:45:31

Hm, I can't see why that shouldn't work, not sure here. I'll take a closer look at this soon.


gaz
Registered User
Quote
2011-06-01 02:51:40

I'm having a similar issue. In CopperCube I set proximity events on objects, but they don't seem to do anything when published to CopperLicht.

A couple examples:

I created a ground surface (a large flat cone) and to keep from running off the edge and falling into a void, I created a fence around the perimeter. Whenever I would to the edge I'd get stuck to the fence and be unable to move off it. So I set a proximity event to the fence so that if I got too close it would transport me to <0, 20, 0>, 20 units above the center of the scene. With the proximity event nothing happened. I attached the event to a keypress but it only transported me 20 units straight up and I was still stuck.

I created an archway in 3DS Max and used a plane as a curtain over the opening of the archway. I set a proximity event on the plane so that if I ran into the plane it would open a new browser window (as a test). Nothing happens.


mushra
Registered User
Quote
2011-12-06 19:54:12

I'm having a similar problem to this.
I have a player and when he walks into a hole in the ground he will land on a upside down spinning cone. When this happens I want him to spin, but the function is never called. My function is like this:
engine.ingComplete = function()
{
var objPlayer = scene.getSceneNodeFromName( 'clerk' );
var objBlackHole = scene.getSceneNodeFromName( 'blackHole' );

var animator1 = new CL3D.AnimatorOnProximity( scene, 400, objPayer.Id, spin, false );
objPlayer.addAnimator( animator1 );
}


spin() just increases the player's Y rotation value.


mushra
Registered User
Quote
2011-12-06 20:19:15




niko
Moderator
Quote
2011-12-07 08:04:12

wrote:
I attached the event to a keypress but it only transported me 20 units straight up and I was still stuck.

That's because with the collision response behavior attached to you, you can't go through walls.

wrote:
I have a player and when he walks into a hole in the ground he will land on a upside down spinning cone. When this happens I want him to spin, but the function is never called.

This is a bug in CopperLicht, the function really is actually never called. Will be fixed in the next update. In the meantime, you can patch CopperLicht with your code yourself: Each AnimatorOnProximity has a function named 'invokeAction'. It gets called to trigger the function. You can simply set it to your function and it should work, like yourAnimator.invokeAction = spin.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Int?rnational" (you are not logged in)


Text:

 

  

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


   






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