Quick Links:
Download Gideros Studio
|
Gideros Documentation
|
Gideros community chat
|
DONATE
Dragging body in b2 — Gideros Forum
Home
Discussions
Sign In
Home
›
General questions
Sign In
·
Register
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Register
Quick Links
Categories
Recent Discussions
Categories
7.8K
All Categories
11
Help with translations
4.2K
General questions
107
Roadmap
358
Game & application design
316
Plugins
70
User experience
75
Marketplace
291
Code snippets
34
Building a team?
269
Suggestions & requests
352
Announce your apps made with Gideros.
90
Step by step tutorials
668
Bugs and issues
195
Introduce yourself
239
Announcements
106
Forum talk
404
Relax cafe
In this Discussion
November 2011
atilim
November 2011
eclisse
Top Posters
ar2rsawseen
6991
SinisterSoft
4058
hgy29
3649
keszegh
3257
atilim
2892
antix
2136
MoKaLux
2014
OZApps
1983
totebo
1781
oleg
1706
hgvyas123
1412
techdojo
1321
pie
1194
gorkem
1186
rrraptor
1030
phongtt
1029
Mells
1024
MikeHart
1020
john26
995
GregBUG
962
Dragging body in b2
eclisse
Member
November 2011
edited November 2011
in
General questions
Hello
Sorry for the very noob question: could someone publish an example of how to drag (with mouse or touch) a body in a box2d world that interacts with other bodies ?
Thanks a lot!
+1
-1
Share on Facebook
Comments
atilim
Maintainer
November 2011
edited November 2011
I think the most stable way is using the mouse joint:
MOUSE_DOWN -> create the mouse joint (with bodyA=any ground (static) body and bodyB=your body)
MOUSE_MOVE -> update the mouse joint's target by calling joint:setTarget(x, y)
MOUSE_UP -> destroy the mouse joint
There is an example "Elastic Joints" that shows how to use mouse joints.
http://en.wikipedia.org/wiki/Cytorus
+1
-1
Share on Facebook
eclisse
Member
November 2011
Thanks ! I'll study that example!
Cheers,
Paolo
+1
-1
Share on Facebook
eclisse
Member
November 2011
That was exactly what I needed, thanks a lot !
+1
-1
Share on Facebook
atilim
Maintainer
November 2011
great
http://en.wikipedia.org/wiki/Cytorus
+1
-1
Share on Facebook
Sign In
or
Register
to comment.
Powered by Vanilla
Comments