views:

266

answers:

2

What I'm trying to do with MRS is to teach myself some basic AI; what I want to do is to make a rocket entity, with things such as vectored exhaust, and staging. Anyone have an idea on how to make an entity that can fly? Or do I just need to constantly apply a force upwards?

+3  A: 

Hey TraumaPony, your question looked lonely :)

I took a look at an MSDN article about MRS 2.0 here I believe you'll actually need to create a Rocket entity of some kind and then a Thruster entity that it can use. In the article they were able to reuse a DifferentialDrive entity to propel their bot forward. I hope that helps. I'm more or less shooting in the dark since no else has tried to help ya out yet. Cheers! :)

Justin Bozonier
+2  A: 

I'm just starting with MRS myself - but I think you are on the right track, you need to create a rocket engine entity that you can apply a thrust force to. See Simulation Tutorial 2 - Compose Entities with Simulation Services for an example of creating an entity.

You can apply force with Simulation.Physics.PhysicsEntity.ApplyForce(). I think you'd do that in your entity's Update() method. But it depends if ApplyForce is actually applying an Impulse (a force for that frame only) or if it's really adding a persistant Force. I'm assuming its the former, since I see no way of unapplying. In that case, Update() is probably the right place. If it is persistant, you only need to do it when thrust levels change.

You'll also need to create a Service that partners with the Entity so that you can interact with your rocket, for instance to fire or vector it. There's an example of Service Creation in the same article.

AShelly