entity colour

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
dietmar
Posts: 1
Joined: Fri Dec 05, 2008 11:08 pm

entity colour

Post by dietmar »

How can I select the colour/s of a sphere created with the help of BEPU?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: entity colour

Post by Norbo »

Did you get my e-mail? I'm not sure if it went through, but here's a way to do it:

Currently, color is randomly set in the EntityDrawer.addEntity and EntityDrawer.addDisplayObject methods within the demos display system. There are cases that cover shader instancing and non-shader instancing modes within these methods, either taking a texture for non-shader instanced objects or a texture index for shader instanced objects. Secondary methods which have a parameter of a color texture or index could be added to replace the random method.

Then, at the end of the startSimulation method of Demos.cs, you could remove the DisplayObject creation. This would then require each entity added to the space to also be manually added to the entity drawer. Alternatively, setting an entity’s tag with entity.tag = “noDisplayObject” will prevent that block from adding that specific entity to the entity drawer. The special color defining addEntity or addDisplayObject could then be used manually for only that entity.
Post Reply