newWeldJoint with moving bodies

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
zell2002
Citizen
Posts: 75
Joined: Sun Feb 23, 2014 9:22 pm

newWeldJoint with moving bodies

Post by zell2002 »

i have Body A (player), and want to attached Body B to it.
i have this :

Code: Select all

sekf.joint = love.physics.newWeldJoint(
	self.Body, other.Body, 
	self.Location.x, self.Location.y)
the joint is created as i can see it being drag (in the debugs), but Body B just falls to the floor, and when i move Body A, Body B doesnt follow.
(Their respected Joints move with them)

I've tried setting Body B's density 0, 1, 0.5, 0.000000003
ive tried setting Body B's phys type to : static, dynamic, and kinematic

Body A, has a density of 1 and a phys type of "dynamic"

when i spawn Body B into the world Ive tried setting its location to be same location as Body A and somewhere else

I get the same results regardless of what I try

Am I wrong in assuming that Body B should attach to Body A and thus follow its position ?
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: newWeldJoint with moving bodies

Post by s-ol »

zell2002 wrote:i have Body A (player), and want to attached Body B to it.
i have this :

Code: Select all

sekf.joint = love.physics.newWeldJoint(
	self.Body, other.Body, 
	self.Location.x, self.Location.y)
the joint is created as i can see it being drag (in the debugs), but Body B just falls to the floor, and when i move Body A, Body B doesnt follow.
(Their respected Joints move with them)

I've tried setting Body B's density 0, 1, 0.5, 0.000000003
ive tried setting Body B's phys type to : static, dynamic, and kinematic

Body A, has a density of 1 and a phys type of "dynamic"

when i spawn Body B into the world Ive tried setting its location to be same location as Body A and somewhere else

I get the same results regardless of what I try

Am I wrong in assuming that Body B should attach to Body A and thus follow its position ?
Are you sure that both bodies already exist at the time you build the joint? It should definetely work like this usually. You should upload your code.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
zell2002
Citizen
Posts: 75
Joined: Sun Feb 23, 2014 9:22 pm

Re: newWeldJoint with moving bodies

Post by zell2002 »

i would really like to upload my code, but its currently a bit of a mess. i will try and tidy up before i post

i think both bodies already exist, if they didnt the call to .newWeldJoint() would throw an error ? (I assume..)
the process for everything is as follows:

BodyA exists

-- player input (f4) - calls function foo()

function foo()
createBodyB()
createJoint()
end

** edit
newRopeJoint() works as expected :S
zell2002
Citizen
Posts: 75
Joined: Sun Feb 23, 2014 9:22 pm

Re: newWeldJoint with moving bodies

Post by zell2002 »

** solved

the child body i was attaching had bFixedRotation = true, changing this to false fixed everything
Post Reply

Who is online

Users browsing this forum: No registered users and 202 guests