Walking character with smooth interaction with externals moving bodies

Software: Away3D 4.x

entropic, Newbie
Posted: 13 July 2012 10:10 AM   Total Posts: 16

I have big difficulties in making a good physics walking character.
My problem is the following one:

If i use the AwayPhysics “default” walk character : the AWPGhostObject, i don’t like the sollution for the collision event with environement mobile bodies:

private function characterCollisionAdded(event AWPEvent) : void {
   
if (!(event.collisionObject.collisionFlags AWPCollisionFlags.CF_STATIC_OBJECT)) {
    
var body AWPRigidBody AWPRigidBody(event.collisionObject);
    var 
force Vector3D event.manifoldPoint.normalWorldOnB.clone();
    
force.scaleBy(-30);
    
body.applyForce(forceevent.manifoldPoint.localPointB);
   
}
  } 

..in other words , here is writed that if my ghost object collide an external moving object, this one wil be moved with some force ADDED IN EXACT THE CONTACT MOMENT. This wil cause a fragmented interaction with all externals bodies from scene. (...and REALLY it is so !!)

On the other side
It is possible to make my own walk character, a simple
capsule shape like this:

var shape AWPCapsuleShape = new AWPCapsuleShape(200400);
   
//------------------------------------------------------------------------------------------------
   
var egoGeom:CapsuleGeometry = new CapsuleGeometry(200400)
   var 
testMesh Mesh = new Mesh(egoGeomemptyMat2);
   
scene.addChild(testMesh);
   
//------------------------------------------------------------------------------------------------ 
   
egoCaps = new AWPRigidBody(shapetestMesh10);
   
scenaPhysics.addRigidBody(egoCaps); 

with a simple vertical restrictions

egoCaps.angularFactor = new Vector3D(00); 

and wich will move with

egoCaps.applyCentralImpulse(new Vector3D(...some params....)) 

and THIS ONE will interact VERRY SMOOTH with all externals bodies, but has it own big problem:
DON’T HAVE A CONSTANT , LINEAR VELOCITY….


So:
Does anyone found a sollution for a GOOD walk character, with both this characteristics:
1. Have a constant speed
2. Have a smooth interaction with environment movable bodies

   

Yang Li, Administrator
Posted: 17 July 2012 01:08 AM   Total Posts: 80   [ # 1 ]

don’t use applyCentralImpulse, try to set linearVelocity directly, and set linearDamping.

   

entropic, Newbie
Posted: 17 July 2012 09:41 AM   Total Posts: 16   [ # 2 ]

Well, i considered this option, but as i said, I dont liked verry much the way of interaction with the other objects. Is fragmented, not smoothed.
Finnaly i found the perfect sollution. I remembered it, since i used the Havok Physics in shockwave.
This was in havok the way of character moving with smooth interaction:

//force
   
sn 70*Math.sin((cameraContainer.rotationY)*Math.PI/180)
   
cs 70 Math.cos((cameraContainer.rotationY) * Math.PI 180)   
   
force = new Vector3D(speed sn speedL cs0speed cs speedL sn)
   
egoCapsule.applyCentralForce(force)
  
   
   
//resistence
   
rezist = new Vector3D(-20*egoCapsule.linearVelocity.x0,-20*egoCapsule.linearVelocity.z)
   
egoCapsule.applyCentralForce(rezist

this result in a perfect physics character.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X