Community Forum

Create new Joint with jointCreater

Forum Overview >> Scripting

CategoryScripting
Created20.02.2010 14:47


Thomas H. (Patar) 20.02.2010 15:43
Hi

i need to make a new Joint in the game, i ask a man who knows many about this things, but he couldn't really help me, actually this part lokks like this:

local constr = JointConstructor:new();
local x,y,z = getWorldTranslation(v1.components[1].node);
local x1,x2,x3 = worldToLocal(self.components[1].node, x,y,z);
setTranslation(self.jointpunkt , x1,x2,x3)
print("x1="..x1..",y1="..y1..",z1="..z1)
constr:setActors(self.components[1].node , v1.components[1].node);
constr:setJointTransforms(self.jointpunkt , v1.components[1].node);
for i=0, 2 do
constr:setTranslationLimit(i, true, 0, 0);
constr:setRotationLimit(i, 0, 0);
end;

local joint = constr:finalize();




Can you please tell me what is wrong? in the log-file is no error about this, but my joint doesn't work

Benjamin G (Unknown) 21.02.2010 13:06
v1 is nil ^^
you must "create" this with "local v1"

Thomas H. (Patar) 21.02.2010 14:14
no, v1 isn't nil:

for k1,v1 in pairs(self.vehiclesInRange) do
local constr = JointConstructor:new();
local x,y,z = getWorldTranslation(v1.components[1].node);
local x1,x2,x3 = worldToLocal(self.components[1].node, x,y,z);
setTranslation(self.jointpunkt , x1,x2,x3)
for i=0, 2 do
constr:setTranslationLimit(i, true, 0, 0);
constr:setRotationLimit(i, 0, 0);
end;
constr:setActors(self.components[1].node , v1.components[1].node);
constr:setJointTransforms(self.jointpunkt , v1.components[1].node);


local joint = constr:finalize();
end;


with "print("x1="..x1..",y1="..y1..",z1="..z1)" i check where the "jointPunkt" is, and it is print me the right coordinates


Note: Log in to post. Create a new account here.