using a service to set force to a box

Hi,

i will write a service to

set a force to a box.

My Entity for the box looks like this.

publicclassMoveBoxEntity :SingleShapeEntity

{

public MoveBoxEntity(Shape shape,Vector3 position)

:base(shape, position)

{ }

publicoverridevoid Update(FrameUpdate update)

{

base.Update(update);

PhysicsEntity.ApplyForce(newVector3(50, 0, 0));

}

}

I will set the forces with a WinForm.

i cant set the ApplyForce

If i do this

movebox.MoveBoxEntity request =new movebox.MoveBoxEntity();

i can only use

request.update

i dont know why

Thanks

[1589 byte] By [ifmerlin] at [2008-1-9]
# 1

Your question isn't entirely clear to me but I'll try to give you an answer.

You have defined an entity called MoveBoxEntity. You need to insert this entity into the simulation environment as follows:

MoveBoxEntity myEntity = new MoveBoxEntity();

SimulationEngine.GlobalInstancePort.Insert(myEntity);

The way you've defined MoveBoxEntity, this box will immediately begin moving as soon as it is inserted into the simulation environment because a constant force is being applied to it each frame. Update is called each frame in the simulator.

You could make the force vector a field on the MoveBoxEntity:

public Vector3 force = new Vector3(0,0,0);

and then in the Update method you would call

PhysicsEntity.ApplyForce(force);

and the windows form that you want to use to control the force would just set the force vector on the entity. Then, each frame, that force would be applied to the entity.

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

Microsoft Robotics Studio

Site Classified