|
Alex Bogartz, Sr. Member
Posted: 13 September 2011 12:29 AM Total Posts: 216
I’m not sure if this is implemented or if there’s a handy workaround, but is there a way to make a rigidbody NEVER rotate? I’m playing around with a game idea and I want the character to not tilt and rotate when he jumps onto a ledge.
I’ve set angularDamping all the way to 1 but that only seems to lock the mesh in a half tilted state. I’d like to have it never rotate at all.
|
Alex Bogartz, Sr. Member
Posted: 13 September 2011 12:34 AM Total Posts: 216
[ # 1 ]
And…...I just noticed you have a class called “AWPKinematicCharacterController”.
Ok, I’ll play with this tomorrow. Pretty awesome code, guys!
|
Yang Li, Administrator
Posted: 13 September 2011 01:04 AM Total Posts: 80
[ # 2 ]
yeah, you can use AWPKinematicCharacterController create the character control, and if you want locking rotation of rigidboies, just need set the angularFactor, like so:
body.angularFactor=new Vector3D(0,0,0);
|
Alex Bogartz, Sr. Member
Posted: 13 September 2011 01:56 AM Total Posts: 216
[ # 3 ]
Yes, that did it, thanks!
|
Alex Bogartz, Sr. Member
Posted: 14 September 2011 04:46 PM Total Posts: 216
[ # 4 ]
Possible bug with the Character Controller?
I have adapted the CharacterDemo to use a model I whipped up in Blender. In the controller class, there is a function called onGround()
/** * whether character contact with ground */ public function onGround():Boolean { return (verticalVelocity == 0 && verticalOffset == 0); }
The problem is that when starting the application, these numbers are not close to zero. I get -55 and 1.35. Where do those numbers come from and is there a way to get those to “normalize” to zero?
|
Alex Bogartz, Sr. Member
Posted: 14 September 2011 08:47 PM Total Posts: 216
[ # 5 ]
Ok, fixed this by not using a AWPStaticPlaneShape but instead setting “ground” as a box shape.
var groundShape:AWPBoxShape = new AWPBoxShape(1000, 100, 1000); groundBody = new AWPRigidBody(groundShape, null, 0); groundBody.position = new Vector3D(0, -100, 0); physicsWorld.addRigidBody(groundBody);
So by just making a thin box I’m able have something to hit. I’m moving this around in code so it doesn’t have to be very large and there’s no geometry with it.
|