#What Object sub can I assign a camera to at runtime?
1 messages · Page 1 of 1 (latest)
Thanks for reaching out @opal trail
Please read through the following and share the information requested. This will help us to better assist you.
Description
Describe the issue that you're seeing. Please be as detailed as possible e.g. is this issue happening in Unity or Blender, which Needle Engine version are you using, do you see any errors in the Editor or Browser console, etc.
Information:
- If you're using Unity click the menu item Needle Engine/Report a Bug/Copy Project Info to Clipboard. Please share the results below.
- Please provide code snippets using Discord Code Blocks
- Have you contacted Needle through another channel or just through Discord?
Thanks for submitting!
💡 Did you know that we now also have a forum with AI support? Join now with your discord account!
i will try this code
this.orbitControl?.setLookTargetPosition(this.gameObject);
this.context.mainCameraComponent!.gameObject.transform.parent =this.gameObject.transform;
but It seems to work strangely
Hi, the code you provided isnt correct - in three.js you can not assign the parent like that. You add the object to it.
this.gameObject.add(this.context.mainCameraComponent.gameObject) would be correct
You'll find some helpful documentation coming from Unity here: https://engine.needle.tools/docs/getting-started/for-unity-developers.html
Needle Engine provides a tight integration into the Unity Editor. This allows developers and designers alike to work together in a familiar environment and deliver fast, performant and lightweight web-experiences.
The following guide is mainly aimed at developers with a Unity3D background but it may also be useful for developers with a web o...
Also note that there's no Unity runtime involved. Your code is running in Needle Engine which runs on three.js (this.gameObject = Object3D in threejs)
this.gameObject.add(this.context.mainCameraComponent.gameObject)
i use this code but don't following parent Object
How can a camera follow a moving parent's object
Or is there a way to keep up with the movement without setting up a parent object?
Please answer the following:
- Are you using any editor?
- What's your current scene setup? Can you show your hierarchy in e.g. Unity/Blender/Code screenshots?
- What's your goal? Do you plan to re-assign the parent?
One other easy way would be: add a SmoothFollow component to the camera object (either via Code or via Editor) and give it your new object as a target
I using Unity Editor
Q : What's your goal? Do you plan to re-assign the parent?
A : Yes