13 July 2016 17:31
Hello,
my name is Fabio and I am really new here :-)
In a test project I am writing, I am trying to detect cubes collisions but there must be something that escapes me because the events are not fired.
My code is quite simple: for each cube in my scene, I do the following:
but even if the objects actually collide in the scene, the "HIT!" message never appears on my debug console.
What should I check?
Thank you for the support.
Ciao
Fabio
my name is Fabio and I am really new here :-)
In a test project I am writing, I am trying to detect cubes collisions but there must be something that escapes me because the events are not fired.
My code is quite simple: for each cube in my scene, I do the following:
var obj = objs[i];
if ( m_phy.has_physics(obj) )
{
m_phy.enable_simulation ( obj );
// create sensors to detect collisions
var sensor_col = m_ctl.create_collision_sensor ( obj, "ANY" );
m_ctl.create_sensor_manifold (
obj, "COLLISION", m_ctl.CT_CONTINUOUS, [ sensor_col ],
function ( o ) { return o [ 0 ]; }, function () { console.debug ( "HIT!"); }
);
}
but even if the objects actually collide in the scene, the "HIT!" message never appears on my debug console.
What should I check?
Thank you for the support.
Ciao
Fabio
http://www.os3.it