locked
changing entity colors RRS feed

  • Question

  • I'm trying to cause a change in color of some SphereShape entities, after their initial assignment of color using:

     

    globe[count].SphereShape.State.DiffuseColor =

                new Microsoft.Robotics.PhysicalModel.Vector4(0, 0, 1, 1f);

     

    this works without a problem immediately after the entity has been inserted using:

     

    SimulationEngine.GlobalInstancePort.Insert(globe[count]);

     

    but when I come back to the globe[count] entities at a later stage I am able to change state related items, such as:

     

    globe[count].State.Pose.Position.Y += 2.5f;

     

    but SphereShape.State items don't seem to have any effect.  At present the globe[count] array is held as a static array within a simple class, accessible from all over my code, much like the terrainData class in my last post.  I've found that it is possible to delete the entity, re-define it, re-insert it, and then give it a new color, but this seems a little clunky.  Ideas?

     

    Cheers, and for those who observe it happy Easter;

    Ross.

    Thursday, April 5, 2007 10:48 AM

Answers

All replies

  • Currently the color is used only when creating a mesh. Dynamic material colors will be implemented soon.

     

    What is the effect you are trying to create?

    Monday, April 9, 2007 8:01 PM
  • Thanks for the reply, any indication on timeframe?

    As to the effect I'm going for: I'm using small spheres beneath the vertices in the terrain in wire-frame visual mode to display the progress of a simulated multi-robot mapping task.  Changing colors in the spheres could be coded to indicate confidence in the data, time since the location was last inspected, and so on.

     

    Ross.

     

    Monday, April 9, 2007 11:57 PM
  • Being able to animate materials should hopefully be in the next release. Perhaps it might be nice to have dummy objects like lines, spheres, arrows, etc to litter the scene with to make testing easier?

    Tuesday, April 10, 2007 6:22 PM
  • Sounds good- and you're right, dummy objects will help with testing too.

     

    Ross.

    Tuesday, April 10, 2007 11:25 PM
  • Can someone tell me if its now possible to change the entity color at runtime (e.g. in the update method).

    If yes, how?

     

    Thanks,

    S@ilor

     

    Tuesday, January 15, 2008 3:17 PM
  • I've written a post here http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2725436&SiteID=1&mode=1 to explain how to do this.

     

    -Kyle

     

    Wednesday, January 23, 2008 1:00 AM