isVector3 is present when serializing Vector3
See original GitHub issueDescribe the bug
A clear and concise description of what the bug is. Before submitting, please remove unnecessary sections.
since r141, when serializing Vector3 class using JSON.stringify, isVector3
is present
To Reproduce
Steps to reproduce the behavior:
- Go to ‘…’
- Click on ‘…’
- See error
Code
// r141
console.log(new THREE.Vector3())
// output:
// {isVector3: true, x: 0, y: 0, z: 0}
// r140
console.log(new THREE.Vector3())
// output:
// {x: 0, y: 0, z: 0}
Live example
*140 Expected behavior
Should not contains isVector3
( also, I don’t think it is a good idea to have a boolean inside an heavily use class memory wise )
Screenshots
Platform:
- Device: [Desktop, Mobile]
- OS: [Windows, MacOS, Linux, Android, iOS]
- Browser: [Chrome, Firefox, Safari, Edge]
- Three.js version: [dev, r???]
Issue Analytics
- State:
- Created a year ago
- Comments:39 (28 by maintainers)
Top Results From Across the Web
Vector3 is not marked serializable - Unity Forum
I do. But, when there is Vector3 as member, it will say Vector3 is not marked serializable.
Read more >c# - How to serialize a Vector3 using binary serializer?
Seems Vector3 is not serializable (as well as Quaternion). Wrap it within your own V3 class/struct or serialize each float individually.
Read more >Vector3 – three.js docs
Class representing a 3D vector. A 3D vector is an ordered triplet of numbers (labeled x, y, and z), which can be used...
Read more >three.js - Apple Open Source
setFromEuler() now expects an Euler rotation rather than a Vector3 and order. ... Object.assign( Vector3.prototype, { isVector3: true, set: function ( x, y, ......
Read more >Team:Munich/Hardware/threeJS - iGEM 2018
// We compute the minimum and maximum dot product values. If those values // are on the same side (back or front) of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m worried that this thread seems pretty far down a very niche path… THREE.Vector3 does not need to be optimized around storing millions of Vector3 instances in memory — that’s a terrible choice for performance regardless of this particular boolean property. This is the reason why three.js (and GPU APIs) have moved toward typed-array-based APIs like BufferAttribute instead. If you need to iterate over many vertices, a small number of vectors should be pooled and initialized, when needed, from compact binary views.
Let’s keep
.is
properties please, they’re fine. 🙏Well, never mind, we did something really stupid ( I removed the
simplifyRadialDist
from the typedarray buffer test … ). I guess I’m not blown away anymore !For science:
With
simplifyRadialDist
on both test ( vec3, typedarray ):Without
simplifyRadialDist
on both test ( vec3, typedarray ):We were comparing vec3 with
simplifyRadialDist
against typedarray without. Not really a fair fight. At least I now have peace of mind on that because I was really disturb when we tried.