Box2D Forums

It is currently Fri May 24, 2013 12:09 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sun Jan 22, 2012 5:17 pm 
Offline

Joined: Sun Jan 22, 2012 4:50 pm
Posts: 2
hi,

I am not to box2d but I am attempting to make a world that supports a specific type of user interaction.

A user can click on and move around any dynamic object. When doing so the dynamic object should not have an impact on other objects in the world. I do this by making it a sensor at that time. I then transform to body to the location of the user's touch. However the body still falls with gravity. So I then made the body static.

When the user releases the body it should re-appear in the physics world without any forces active on it.

so

touch starts

make a sensor
make static
move to touch position throughout the drag

on release
no longer a sensor
make dynamic

This does almost everything I want. With the exception that while I drag the body across the screen I want to know what it collides with. Being that my body is now a static sensor this works fine with the exception of it does not detect contact with other static bodies. And I need it to detect contact with static bodies.

Is there a way to make the contact listener fire for the contact of two static bodies or is there another way to get this interaction?

thanks


Top
 Profile  
 
PostPosted: Mon Jan 23, 2012 5:53 am 
Offline

Joined: Tue Jun 24, 2008 8:25 pm
Posts: 1517
Location: Tokyo
How does it fall with gravity if you are transforming it to the location of the user's touch?


Top
 Profile  
 
PostPosted: Mon Jan 23, 2012 7:18 am 
Offline

Joined: Sun Jan 22, 2012 4:50 pm
Posts: 2
It only moves position as the user's move the touch. If the user holds there hand in a given position the object drops because it's no longer being moved.


Top
 Profile  
 
PostPosted: Mon Jan 23, 2012 9:15 pm 
Offline

Joined: Tue Jun 24, 2008 8:25 pm
Posts: 1517
Location: Tokyo
Couldn't you just keep setting its position until the user lifts their finger?
If gravity really bothers you, it can be canceled by applying an equivalent and opposite force upwards to that body -> link.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group