object drop from another as long as moving

hello every body

i have 2 object … the first is moving … and i want to drop the second from the first as long as she is moving

so i need help plz [import]uid: 96162 topic_id: 35778 reply_id: 335778[/import]

Hello,
Are you using physics? Or just transitions or direct positional updates?

[import]uid: 200026 topic_id: 35778 reply_id: 142333[/import]

hello … im using physics >> but if its possible in another way … tell me [import]uid: 96162 topic_id: 35778 reply_id: 142384[/import]

Hello,
Physics is fine. :slight_smile: At the most “simple” level, I would suggest that you put the dropping object at the same location as the character object. Then, read the physical velocities of the character using this line:

local vx,vy = myCharacter:getLinearVelocity()

Then, set the same velocities on the dropping object, so they mimic the same physical velocities:

myDroppingItem:setLinearVelocity( vx,vy )

Hope this helps,
Brent [import]uid: 200026 topic_id: 35778 reply_id: 142390[/import]

sorry … but it doesn’t work … can you give another way [import]uid: 96162 topic_id: 35778 reply_id: 142623[/import]

Hello,
Are you using physics? Or just transitions or direct positional updates?

[import]uid: 200026 topic_id: 35778 reply_id: 142333[/import]

hello … im using physics >> but if its possible in another way … tell me [import]uid: 96162 topic_id: 35778 reply_id: 142384[/import]

Hello,
Physics is fine. :slight_smile: At the most “simple” level, I would suggest that you put the dropping object at the same location as the character object. Then, read the physical velocities of the character using this line:

local vx,vy = myCharacter:getLinearVelocity()

Then, set the same velocities on the dropping object, so they mimic the same physical velocities:

myDroppingItem:setLinearVelocity( vx,vy )

Hope this helps,
Brent [import]uid: 200026 topic_id: 35778 reply_id: 142390[/import]

sorry … but it doesn’t work … can you give another way [import]uid: 96162 topic_id: 35778 reply_id: 142623[/import]