brianzinn / react-babylonjs

React for Babylon 3D engine
https://brianzinn.github.io/react-babylonjs/
818 stars 105 forks source link

camera target not work #170

Closed stanleySHU closed 2 years ago

stanleySHU commented 2 years ago

camera target not work. version: 4.2.0 <freeCamera name="camera" position={new Vector3(0, 1000, 0)} target={new Vector3(0, 0, 0)}/>

brianzinn commented 2 years ago

hi @stanleySHU - I think the target does work, but the thing about the reconciler is that the position and target and setting them produces unexpected behaviour. Look here as an example: https://www.babylonjs-playground.com/#6P3E3K

image What happens is that when the position changes that the target changes by the same amount.

You maybe want to use lockedTarget and I just checked and that property is indeed not supported, but if that is what you are after then I could add it. https://doc.babylonjs.com/typedoc/classes/babylon.targetcamera#lockedtarget

brianzinn commented 2 years ago

sorry, but I didn't mean to close actually. Please re-open if it's not solved for you.