Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Any way to drag&drop static box2d objects? — Gideros Forum

Any way to drag&drop static box2d objects?

rrraptorrrraptor Member
edited September 2016 in General questions
Hi there.
So, i need to D&D static box2d objects, but dynamic objects shoud correctly react to that. For example, if i have dragable platform (static object) at the bottom of the screen and dynamic box above it, then when i move platform from bottom to top, box shoud gain impulse and bounce from platform when i drop platform.
I was trying to use mouse joint, but it didnt work.
Any other solutions?
Simple project attached (just in case) :D

And another quick question. How to correctly override Sprite methods setX, setY, setPosition and e.t.c.? Right now i have something like this:
function Box:setX2(x)
	self:setX(x)
	self._body_pos[1] = x
	self.body:setPosition(x, self._body_pos[2])
end
 
function Box:setY2(y)
	self:setY(y)
	self._body_pos[2] = y
	self.body:setPosition(self._body_pos[1], y)
end
 
function Box:setPosition2(x,y)
	self:setPosition(x, y)
	self._body_pos[1] = x
	self._body_pos[2] = y
	self.body:setPosition(x, y)
end
zip
zip
Drag_static_box2d.zip
4K

Comments

Sign In or Register to comment.