Is it possible to make an invisible object always appear on ground layer at camera forward position then rotate around it using this as transform object? #child, #pivot, #cameraHolder
Parent the camera to an invisible GameObject and then set the local Z position of your camera object to the distance you want to orbit the invisible object at. Rotate the invisible object to pan around.
How would I make this child object trace the ground if it’s locked on static offset on camera local z axis. If I zoom in on camera local z-axis, I want object not to go through ground, maybe using colliders or something. When I zoom out, I do not want child object to leave ground and follow camera in air on camera local z-axis. Child object always tracing ground. Would it be possible to shoot out a ray or something?
This RTScamera asset, link bellow, is exactly what I am trying to make. You can see how the green ball always remain in center of camera regardless of zoom on camera local z-axis, demo below. It says documentation and source included. Does this mean I can watch every script to learn?
You can see LookAt, green ball, is climbing on the green objects, but not on the blue walls or red piles. Is this due to collision settings?
Demo:
http://voxelfrog.azurewebsites.net/Demos/Public/RTSCameraPro/index.html
Asset:
You move the child (the camera)'s local position to zoom in and out. You move the parent (the invisible object) to translate the camera. You rotate the parent to orbit the camera. If you add a collider and rigidbody to the parent, and use rigidbody.MovePosition() to avoid physical forces, your object will not go through walls.
Logic for obstruction detection on the child (the actual camera) would be more involved. There are examples in the Standard Assets pack. You may consider using Cinemachine as well. Both are free.