question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

geometry primitive undefined so fallback to box

See original GitHub issue

Description:

  • A-Frame Version: 0.9.0
  • Platform / Device: Chrome on desktop
  • Reproducible Code Snippet or URL:

I have simple code that do

const plane = document.createElement("a-plane");
plane.setAttribute("height", 0.196);
plane.setAttribute("width", 0.196);
AFRAME.scenes[0].appendChild(plane)

initially it shows a plane, now if I remove the plane element AFRAME.scenes[0].removeChild(plane) and recreate it, it will take an object from the pool and it will sometime show a box instead of a plane. Somehow I get “primitive: undefined” in the object.

Putting a console.log(this.attrValue, this.data) in src/core/component.js initComponent, I get initially

attrValue: {width: "0.196", height: "0.196", primitive: "plane"}
data: {
  buffer: true
  height: 0.196
  primitive: "plane"
  segmentsHeight: 1
  segmentsWidth: 1
  skipCache: false
  width: 0.196
}

and if it take an existing object from the pool (when I remove plane and recreate it), I can get this:

attrValue: {width: "0.196", height: "0.196", primitive: undefined}
or attrValue: {height: "0.196", width: "0.196", primitive: undefined, buffer: undefined, skipCache: undefined, …}
data: {
  buffer: true
  depth: 1
  height: 0.196
  primitive: "box"
  segmentsDepth: 1
  segmentsHeight: 1
  segmentsWidth: 1
  skipCache: false
  width: 0.196
}

and other time: {radius: undefined, width: 0.196, height: 0.196, primitive: "plane", buffer: true, …} triggering a warning: core:schema:warn Unknown property radius for component/system geometry. see #4012 for this one.

Now If I change the implementation of clearObject to delete the keys: for (key in obj) { delete obj[key]; } all the issues goes away.

The issue comes from the commit https://github.com/aframevr/aframe/commit/6deaea0564d18c91b94d801db0e39535b094f044 from the component.js file. I tested master with the component.js file before this commit and I don’t have the issue. The PR #4016 doesn’t fix the issue.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
antoniohofcommented, Feb 27, 2019

workaround: If you set geometry attribute manually, it fixes this error.

After creating your a-plane, do this: plane.setAttribute('geometry', 'primitive: plane')

0reactions
vincentfretincommented, Apr 20, 2019

Thanks @ngokevin ! Your changes indeed fix the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

UsdGeom : USD Geometry Schema - Pixar Graphics
UsdGeomGprim is the base class for all "geometric primitives", ... So, gprims whose orientation is "rightHanded" (which is the fallback) must use the...
Read more >
Bounding Box - SideFX
This operator returns two vectors representing the minimum and maximum corners of the bounding box for the specified geometry. This generates a primitive...
Read more >
DirectX Raytracing (DXR) Functional Spec
An alternative representation for geometry in a bottom-level acceleration structure is an axis aligned bounding box which contains a procedural ...
Read more >
Nanite Virtualized Geometry - Unreal Engine Documentation
The Fallback Relative Error sets the maximum amount of relative error that is allowed when removing details from the source mesh. Any triangles...
Read more >
Primitive Geometry in wgpu and Rust - Ryosuke
I tried omitting it at first, but the shader kept complaining about undefined data. So I put in a placeholder texture for the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found