Hi,
I have a helicopter that the character spawns inside. I've been calculating a path and evaluating this path for the EnityMover and EntityRotator. That approach works fine. When the helicopter moves or rotates the character rotates with it and stays within the helicopter interior.
I have recently being working on a more "flexible" method, as I'd like the helicopter to hug the terrain more and avoid obstacles along the way. I've made the helicopter kinematic, I move it by adjusting its LinearVelocity and I rotate it by calculating a new quaternion for the Body.Orientation based on the helicopter's Yaw.
The problem I have is the character will not collide properly with the inside of the helicopter and will fall out if the helicopter turns too quickly. I have a damage system that, I had to switch off, (it checks info.NormalImpulse of a Pair.Contact) as it was being triggered when the helicopter moved.
I must be doing something very wrong
Is the problem caused by me manually messing with LinearVelocity and Orientation, should I be using a different approach?
Thanks.
EntityRotator and EntityMover Versus Manually Doing It
EntityRotator and EntityMover Versus Manually Doing It
BEPUphysics rules my world
http://cloneofduty.com
http://cloneofduty.com
Re: EntityRotator and EntityMover Versus Manually Doing It
From looking at another post I decided to add this code. It didn't fix it though
I've made a private video: When arriving in the first helicopter, all the collisions are fine, this helicopter is moved by an EnityMover. The second helicopter does not keep the character inside, it is rotated by adjusting the Body.Orientation quaternion and moved by adjusting LinearVelocity.
Code: Select all
Body.ActivityInformation.IsAlwaysActive = true;
Body.PositionUpdateMode = PositionUpdateMode.Continuous;
BEPUphysics rules my world
http://cloneofduty.com
http://cloneofduty.com
Re: EntityRotator and EntityMover Versus Manually Doing It
Setting Orientation directly is a form of teleportation, just like setting Position. Instead, use velocities to control the object. You can either start calculating your own AngularVelocity like you do with the LinearVelocity, or you can just use the EntityRotator which does it for you.
Re: EntityRotator and EntityMover Versus Manually Doing It
Ah! OK. Thanks. I'll get on with it.
BEPUphysics rules my world
http://cloneofduty.com
http://cloneofduty.com
Re: EntityRotator and EntityMover Versus Manually Doing It
Thanks Norbo, how simple to fix, when you know how!
Here's a video of it in action, with a few more changes applied.
Code: Select all
orientation = Quaternion.CreateFromAxisAngle(Vector3.Up, Yaw);
rotator.TargetOrientation = orientation;
BEPUphysics rules my world
http://cloneofduty.com
http://cloneofduty.com