How to create Kinematic Ghost entity (collision-less kinematic entity)

Hi!
I wish to create a kinematic entity that won't collide with any other entities/shapes in the scene. The behavior would be somewhat like Ghost mode in various games when one can pass through walls.
Is there some way to turn the collisions off for a kinematic entity? AGEIA documentation mentions collision groups with switchable collisions. Is anything like that supported here?
[396 byte] By [Piyoosh] at [2008-1-4]
# 1

It sounds like you want an entity with no physics shape associated with it (or possibly one where you can switch the physics shape on and off). The CameraEntity provides an example of one way to do this. Look at the IsPhysicsVisible property of the CameraEntity in samples\simulation\entities\entities.cs. When this property is set to true, the PhysicsEntity associated with the camera is added into the physics scene. When it is set to false, the PhysicsEntity is removed from the scene.

Probably the easiest way for you to do this is to define a new Entity that inherits from SingleShapeEntity. Add an IsPhysicsVisible property much like the CameraEntity property and then you will be able to easily switch the physics entity on and off.

-Kyle

KyleJ-MSFT at 2007-10-3 > top of Msdn Tech,Microsoft Robotics Studio,Microsoft Robotics - Simulation...
# 2
Not exactly! I need an entity with a physics shape. I required to make an entity with Trigger shapes. I'm not interested in rendering the shapes, but I wanted the entity to be massless and collision-free. However, I still don't want it to be static as it is to be moved around in the environment. In effect, I wanted an entity representing a volume of space, giving trigger notifications, and still movable.
The current infrastructure allows me to create a movable (non-static) entity with some massless shapes, but it requires at least one shape to have mass. I am considering a scenario, where none of the shapes have a mass, and the entity is still non-static i.e. it can be moved around.
Piyoosh at 2007-10-3 > top of Msdn Tech,Microsoft Robotics Studio,Microsoft Robotics - Simulation...
# 3

OK. So you want a trigger shape that you can move around. Trigger shapes will not collide with other shapes, they allow other shapes to pass through them. It is better to make it a kinematic entity than a normal entity which contains static shapes. Kinematic entities are moved by you and not by the physics engine. The physics engine assumes that static shapes don't move at all.

To set an entity to be kinematic, you need to do the following after the entity has been initialized:

Code Snippet

YourEntity.PhysicsEntity.IsKinematic = true;

One way to do this is to create a new entity type that inherits from the entity you are using. Override the Initialize method and set IsKinematic true:

Code Snippet

public class KinematicSingleShapeEntity : SingleShapeEntity
{
public KinematicSingleShapeEntity() { }

public KinematicSingleShapeEntity(Shape shape, Vector3 initialPos)
: base(shape, initialPos)
{
}

public override void Initialize(xnagrfx.GraphicsDevice device, PhysicsEngine physicsEngine)
{
base.Initialize(device, physicsEngine);
PhysicsEntity.IsKinematic = true;
}
}

-Kyle

KyleJ-MSFT at 2007-10-3 > top of Msdn Tech,Microsoft Robotics Studio,Microsoft Robotics - Simulation...
# 4

I noticed in another post that you were having a hard time creating a kinematic entity because your shapes had 0 mass. Why is this a requirement? Simply give your shapes a minimal mass to make them dynamic and you shouldn't have a problem making the entity kinematic.

-Kyle

KyleJ-MSFT at 2007-10-3 > top of Msdn Tech,Microsoft Robotics Studio,Microsoft Robotics - Simulation...
# 5

Hi Kyle!

First of all thanks for considering this problem.

Due to the lack of proper documentation, I did lots of combination tests on my entity. My observations are given below. I hope that will help you understand the situation in a better way.

Sr. No.

Trigger shape(s) mass

Non-trigger shape(s) present

Non-trigger shape(s) mass

IsKinematic

Remarks

1.

0

No

N/A

Unable to set true

No error.

State.Pose cannot be changed.

PhysicsEntity.MovePose cannot be used.

The entity is completely static.

2.

>0

No

N/A

N/A

ApplicationException in CreateAndInsertEntity. Message: "Physics engine failed to create entity"

3.

0

Yes

0

Unable to set true

No error.

State.Pose cannot be changed.

PhysicsEntity.MovePose cannot be used.

The entity is completely static.

4.

0

Yes

>0

Can be set to true or false

The non-trigger shape interacts with environment properly depending on IsKinematic. However, the non-trigger shape is not pass-through. Hence, the entity as a whole cannot be pass-through.

5.

>0

Yes

0

N/A

Same as Situation 2.

ApplicationException in CreateAndInsertEntity. Message: "Physics engine failed to create entity"

6.

>0

Yes

>0

Can be set to true or false

Same as Situation 4.

The non-trigger shape interacts with environment properly depending on IsKinematic. However, the non-trigger shape is not pass-through. Hence, the entity as a whole cannot be pass-through.

None of these conditions allow me to create an entity which satisfies all of these properties simultaneously:

  1. Presence of one or more working trigger shapes. (Working means during some tests, I found I could move it by just changing the Position property of PhysicsEntity, but the trigger lost its proper working because of that)
  2. Mobility in environment i.e. its position can be changed by any methods
  3. Complete entity should be pass-through
Piyoosh at 2007-10-3 > top of Msdn Tech,Microsoft Robotics Studio,Microsoft Robotics - Simulation...
# 6
As seen for in the table above, rest of the requirements except third are met by Combinations 4 and 6 in where it's necessary to have at least one non-trigger shape with some mass. It would be nice to have a method available using which I can represent a movable entity made of triggers only (Mass doesn't matter because Simulation engine treats triggers as massless irrespective of specified mass).
Piyoosh at 2007-10-3 > top of Msdn Tech,Microsoft Robotics Studio,Microsoft Robotics - Simulation...
# 7

I really don't understand what problem you are still facing. You just need to make an entity which contains one or more trigger shapes that have mass. Set the entity to be kinematic and you are done. Since it is kinematic, you can move it around however you want and its mass is irrelevant. Since it consists entirely of trigger shapes, it will not collide with other shapes. Isn't this exactly what you need?

-Kyle

KyleJ-MSFT at 2007-10-3 > top of Msdn Tech,Microsoft Robotics Studio,Microsoft Robotics - Simulation...
# 8
That's true.. I need to make an entity with one or more trigger shapes having mass... but if you look at the Situation 2 I mention in post above, I get an ApplicationException in such a case with message "Physics Engine failed to create entity."
Piyoosh at 2007-10-3 > top of Msdn Tech,Microsoft Robotics Studio,Microsoft Robotics - Simulation...
# 9

You're right that the Ageia engine doesn't seem to like kinematic trigger shapes. I have not been able to find a way to create a kinematic trigger entity that is completely made up of trigger shapes. Your best bet is probably to go with situation 4 or 6 in the table above.

-Kyle

KyleJ-MSFT at 2007-10-3 > top of Msdn Tech,Microsoft Robotics Studio,Microsoft Robotics - Simulation...

Microsoft Robotics Studio

Site Classified