@serializable(GameObject)
object01? : GameObject;
@serializable(Object3D)
object02? : Object3D;
Can you provide examples of how GameObjects and Object3D are used differently, or any limitations of each
@serializable(GameObject)
object01? : GameObject;
@serializable(Object3D)
object02? : Object3D;
Can you provide examples of how GameObjects and Object3D are used differently, or any limitations of each
Hi there! I’m your AI-powered assistant. I can help with questions about Needle Engine, three.js, and basic Unity or Blender help. Please reply with your question to get more assistance.
Could you also provide your operating system and version information for Needle Engine, Unity, or Blender if applicable?
2 replies left - GPT 4O
thread_3VgvvYkqPa0mOFsrpPvcqzj9
Reply to this message to continue the conversation
use unity 2022.3.21f1
In Needle Engine, GameObject
and Object3D
serve different purposes in the serialization context. Here’s a brief overview:
GameObject:
Transform
, Collider
, and Renderer
.Object3D:
GameObject
.@serializable(GameObject)
class Player {
object01?: GameObject; // A player with complex behaviors
}
@serializable(Object3D)
class Environment {
object02?: Object3D; // A static object like a tree
}
For more detailed examples, refer to Needle Engine documentation and samples. If you have further questions or need clarification, feel free to ask!
1 replies left - GPT 4O
thread_3VgvvYkqPa0mOFsrpPvcqzj9
Reply to this message to continue the conversation
Hi
short answer is: there is none. The GameObject
is just an alias for Object3D
The slightly longer answer is: We used the GameObject type / alias originally to expose API that we added to three’s Object3D objects in Needle Engine (like addComponent
) and make that visible to you as a user/programmer. But that is just syntax sugar and there’s no actual difference between both. In the more recent versions we’re declaring the added methods using Typescript properly which makes GameObject
obsolete (but it’s still there for compatibility reasons). So now you can write something like new Object3D().addComponent(DragControls)
and the Typescript compiler will be happy
Should I use Object3D?
Yes, just use Object3D (as said above - it doesn’t really make a difference technically)
This topic was automatically closed 13 days after the last reply. New replies are no longer allowed.