Forum rules - please read before posting.

Target direction factor for 3D camera

Hi,
I'm developing a 3d side scroller game and I cannot find a similar function there's in 2D cameras: Target direction factor.
I would like to pan the camera in the direction the player is facing (left or right).
Am I missing some setting?
Thanks

Comments

  • The GameCamera's Target direction fac. field requires that the "Spin rotation" panel has its Affected by field set to Look At Target.

    If your game moves in the X/Z plane, however, you can still rely on the GameCamera 2D camera type. It won't be listed in the Scene Manager for 3D games, but you can still drop it into your scene manually from the /Assets/AdventureCreator/Prefabs/Camera folder.

  • Yes I'm only moving on Z axis. Tried both suggestions but if I enable Spin rotation - Look at target, the cam follow the direction the player is looking but only spinning, not moving left or right panning the view like I would. With the 2d camera, if moving, has a flat background.
    I'll try some scripts on the web or chatgpt, thanks anyway.

  • edited January 6

    No useful scripts found... but I think another solution: I put a cube obj under the head game obj of the player, at about some distance in front of him. When the player turns, the cube is always in front of him, at the distance I want. I set the camera target at that cube so it works like a sort of target dir fac.

    But because of the prefab player is instantiated after I press play, the camera cannot find his child cube... I also tried to put the player prefab in the scene, assign the cube manually (it has the constant ID retain in prefab) as target in the camera, but when I delete the player from the scene, from the camera the target became Missing.
    I also tried not to delete the player from the hiererchy, so when I press play, the reference of the cube is still in the camera target and it works as intended.

    Is there a way to tell the camera that the target is the child cube of the player and not the player?

  • Leaving the Player in the scene is a valid option. If you want to spawn them in, attach a child Marker to the prefab as a child, position where you want the cube to appear, and then use the Object: Teleport and Object: Set parent Actions in your OnStart cutscene to position the Cube over the Marker.

  • Good suggestions, thanks!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.