How to do bounceness?

Software: Away3D 4.x

HowlingBard, Newbie
Posted: 26 September 2011 12:19 PM   Total Posts: 20

Hi, everybody!
I’m trying to set bounceness in the rigidbody, but I’ve got no success until now.
I want to make a primitive sphere, with sphere shape, bounce when it hit a cube or a plane or the ground.
Does anybody has any idea?

   

John Brookes, Moderator
Posted: 26 September 2011 01:05 PM   Total Posts: 732   [ # 1 ]

yourRigidbody.restitution = somevalue;

   

HowlingBard, Newbie
Posted: 26 September 2011 01:16 PM   Total Posts: 20   [ # 2 ]

I already tried to set several values in restitution and it doesn’t work.

here is my code:

var sphere : Sphere = new Sphere(red, 13, 8, 6);
var sphereShape : AWPSphereShape = new AWPSphereShape(13);
 
_view.scene.addChild(sphere);
MyRigidBody = new AWPRigidBody(sphereShape, sphere, 2);
MyRigidBody.restitution = 1; 
MyRigidBody.friction = 0.3;
MyRigidBody.forceActivationState(0);//turn inactive
MyRigidBody.collisionFlags = AWPCollisionFlags.CF_CHARACTER_OBJECT;
MyRigidBody.gravity = physicsWorld.gravity;
MyRigidBody.position = initPos;
physicsWorld.addRigidBody(ballRigidBody);

   

Yang Li, Administrator
Posted: 26 September 2011 02:35 PM   Total Posts: 80   [ # 3 ]

you also need set the ground restitution to 1 or less.

   

HowlingBard, Newbie
Posted: 26 September 2011 04:59 PM   Total Posts: 20   [ # 4 ]

Is there any problem if I use a cube or a AWPBvhTriangleMeshShape in place of the ground to collide?
It’s not working, yet.

   

HowlingBard, Newbie
Posted: 26 September 2011 08:23 PM   Total Posts: 20   [ # 5 ]

I don’t know what was happening before, but I just make the class again and it works now!
Thank you all.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X