Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Sun Jun 19, 2011 3:23 am 
Offline
User avatar

Joined: Wed Nov 11, 2009 9:09 pm
Posts: 29
I'm trying to create a "cargo hook" a sort of a line that one object (a space station or a ship) uses to pull another object (a cargo pod, or another ship)

What's a sensible way of doing this?

I've tried constraints, did some experiments, but i'm not even sure I'm using the right one.
I experimented with the 6 degree of freedom constraint, enabled motors, etc, this gives me a pull, but often not in the correct direction, and it seems to be affected by the pulling ship's orientation, which is baffling me.

Summary:
Are constraints the way to go to achieve a pull effect? Is the 6 degree of freedom constaint the one to use?

thanks for any help


Top
 Profile  
 
PostPosted: Sun Jun 19, 2011 6:01 pm 
Offline
User avatar

Joined: Wed Nov 11, 2009 9:09 pm
Posts: 29
This post is something closer to what I'm looking for: http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=4&t=4864&p=17937&hilit=btPoint2PointConstraint#p17937

It shows a distance constraint, I changed it a bit to add a ->setDistance(float newDistance) if the newDistance is smaller than the old then it will use the new distance meaning that the objects can get closer.

Now I need to figure out how to do the pulling force.

If object a and object b

if object a is larger pull object b to it, if object b is larger pull object a to it

but with actual physics :)


Top
 Profile  
 
PostPosted: Mon Jun 20, 2011 2:25 am 
Offline
User avatar

Joined: Wed Nov 11, 2009 9:09 pm
Posts: 29
The set distance thing to get the distance between the two objects to shrink but not expand worked in debug mode but not release :(

dammit, it tricked me into thinking that I found a loop hole, debug mode worked since the physics step was slower thus less precise :(

Funny thing I discovered while playing around is that I can sort of create a motor by doing this:

Code:
      info->m_constraintError[0] = 5; // Positive to get closer, negative to get further apart


Although the pull/push force is constant and not dependent on the entities, this may work in some way in my project as a tractor beam/repulsor ray.


Top
 Profile  
 
PostPosted: Mon Jun 20, 2011 2:42 am 
Offline
User avatar

Joined: Tue Jun 29, 2010 10:27 pm
Posts: 237
One option besides constraints would be a soft body chain. There is at least one example in the bullet demos of this, where a large block is swinging from an anchored point, connected by one or two chains of soft body nodes connected by links. The effect is fairly nice. You could also change the link resting length to retract/extend the chains, however this feature is not yet officially implemented (though you could do it manually with a little work). But, there is some code posted on the issue tracker that does this. See: http://code.google.com/p/bullet/issues/detail?id=470, which I integrated into issue 503, which has some additional soft body fixes.


Top
 Profile  
 
PostPosted: Mon Jun 20, 2011 3:04 pm 
Offline
User avatar

Joined: Wed Nov 11, 2009 9:09 pm
Posts: 29
thanks! I'll look into that, a soft body would show a neat visual effect.


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

All times are UTC


Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 9 guests


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:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group