In an example code, I have these two functions. What I don't understand is the if clauses:
Code: Select all
if b==sim.handle_parent then
Code: Select all
b=sim.getObjectParent(a)
What is this then? why is this line so vague? if b is not -1 and is a joint, then why
Code: Select all
a=a+sim.handleflag_reljointbaseframe
Code: Select all
if (b~=-1) and (sim.getObjectType(b)==sim.object_joint_type) and (sim.getInt32Param(sim.intparam_program_version)>=40001)
Code: Select all
function __getObjectPosition__(a,b)
-- compatibility routine, wrong results could be returned in some situations, in CoppeliaSim <4.0.1
if b==sim.handle_parent then
b=sim.getObjectParent(a)
end
if (b~=-1) and (sim.getObjectType(b)==sim.object_joint_type) and (sim.getInt32Param(sim.intparam_program_version)>=40001) then
a=a+sim.handleflag_reljointbaseframe
end
return sim.getObjectPosition(a,b)
end
function __getObjectQuaternion__(a,b)
-- compatibility routine, wrong results could be returned in some situations, in CoppeliaSim <4.0.1
if b==sim.handle_parent then
b=sim.getObjectParent(a)
end
if (b~=-1) and (sim.getObjectType(b)==sim.object_joint_type) and (sim.getInt32Param(sim.intparam_program_version)>=40001) then
a=a+sim.handleflag_reljointbaseframe
end
return sim.getObjectQuaternion(a,b)
end