GroundPrimitive and getGeometryInstanceAttributes

I’m using GroundPrimitive to draw a shadow under a vehicle.

Using getGeometryInstanceAttributes with a primitive created using GroundPrimitive is undefined even if releaseGeometryInstances is set to false.

Any help would be appreciated. - Matt

Hi Matt,

Wait for readyPromise to resolve or check for ready to be true before calling getGeometryInstanceAttributes.

Patrick

Can you show an example? Thanks!

Here you go:

shadowPrimitive.readyPromise.then(function(){

var attributes = shadowPrimitive.getGeometryInstanceAttributes(‘shadow’);

});

Awesome. Thanks.

Looks like I can only update color and show. What I really want to do is update position. Am I correct this is not possible? Is there a solution using entity?

Hello Matt,

Ground primitives are not currently hooked up to the entity API. You will have to create a new RectangleGeometry instance every time you want to change the position.

Best,

Hannah

I gave up on the ground primitive and went back to flying a shadow (model) entity beneath the vehicle at 0.5m above the terrain. I sample the terrain height at the vehicle position, at a point 1m in front of the position and 1m to the right of the position. I use the result to calculate the position and orientation of the shadow model. I believe the MilkTruck example does something similar. It works OK for now but I look forward to ground overlay entities (including polylines). Matt.

Matt - on an unrelated note, that looks like an awesome app you are developing. Do you have a link to a demo?

Patrick