Hanging rope

Software: Away3D 4.x

jurito, Newbie
Posted: 14 May 2012 12:48 PM   Total Posts: 2

Hi everyone,
sorry if my question is trivial but i’m quite stuck on it. I thought about a couple of different solutions but nothing that doesn’t look too much as a workaround :

I have a rope, created with many AWPPoint2PointConstraint as in the ConstraintTest example, with a RigidBody attached to each side.
I would like the rope to hang from one of them (and then move the ‘hang’ with keyboard input).

I’m wondering what’s the best way to define that rigidbody position in space, without the gravity affecting it while still being part of the physics world?

TIA

   

John Brookes, Moderator
Posted: 16 May 2012 10:51 AM   Total Posts: 732   [ # 1 ]

Like to know this one myself. Thought it would be easier than what I’ve just come up with.
Which is..

Using the constraints demo code
Just use linear factor to lock the rigidbody, then unlock that axis when you want to move it.

p2pARR [];
var 
rb:AWPRigidBody = new AWPRigidBody(new AWPSphereShape(), null1)
rb.position = new Vector3D( -130015000);
rb.linearFactor = new Vector3D(0,0,0);
physicsWorld.addRigidBody(rb);

for (var 
int 06i++ ) {
 mesh 
= new Sphere(material100);
 
_view.scene.addChild(mesh);
 
prevBody currBody;
 
currBody = new AWPRigidBody(sphereShapemesh2);
 
currBody.position = new Vector3D(-1500 - (200 i), 15000);
 
physicsWorld.addRigidBody(currBody);
 if (
== 0{
  
//p2p = new AWPPoint2PointConstraint(currBody, new Vector3D(100, 0, 0));
  
p2p = new AWPPoint2PointConstraint(currBody, new Vector3D(10000), rb, new Vector3D(0,-100,0));
  
physicsWorld.addConstraint(p2p);
  
p2pARR.push(p2p);
 
else {
  p2p 
= new AWPPoint2PointConstraint(prevBody, new Vector3D(-10000), currBody, new Vector3D(10000));
  
physicsWorld.addConstraint(p2p);
  
p2pARR.push(p2p);
 
}

Then you can do something like

//onKeyDown
AWPPoint2PointConstraint(p2pARR[0]).rigidBodyB.linearVelocity = new Vector3D(1,0,0)
AWPPoint2PointConstraint(p2pARR[0]).rigidBodyB.linearFactor = new Vector3D(100); 

Works, but must be an easier way?

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X