Possible Physics Bug
12 June 2017 20:15
In this thread, we were talking about a shooting ball demo.
What happens is the ball shoots and starts rotating as it hits the ground or other things. Once physics are disabled and the ball is reset, the rotation is somehow 'remembered' by the ball so when you shoot again, it rotates according to the last physics simulation.
This is a logic node + JavaScript project. Project attached.
What happens is the ball shoots and starts rotating as it hits the ground or other things. Once physics are disabled and the ball is reset, the rotation is somehow 'remembered' by the ball so when you shoot again, it rotates according to the last physics simulation.
function throwBall(inParams,outParams) {
m_constr.remove(inParams[0]);
m_physics.enable_simulation(inParams[0]);
m_physics.apply_velocity(inParams[0],0,20,0);
}
function resetBall(inParams,outParams) {
m_physics.disable_simulation(inParams[0]);
m_trans.set_rotation_v(inParams[0],m_quat.create());
m_trans.set_translation_v(inParams[0],m_trans.get_translation(inParams[1]));
m_constr.append_stiff_trans_rot(inParams[0], inParams[1], m_vec3.create());
}
This is a logic node + JavaScript project. Project attached.
13 June 2017 16:26