It looks like you're new here. If you want to get involved, click one of these buttons!
Hello,
I’ve made some searches but I can’t find an easy way to just make my camera follow an entity (player car or train for example)
The doc is unclear about all camera methods for newbies ...
I did attach a camera to an entity with this code
c = train.loco:add(craft.camera, 45, 0.1, 1000, false)
But I don’t know how to adjust camera position to put it above the 3D model and adjust its orientation
C.position.y = 50
Doesn’t seem to work
Comments
@threads I don't know if this will help. I'm not adding the camera like you show above, but I'm moving the camera around the Craft scene. See the code in the link below.
@threads I haven't been able to change the camera position on an entity, but maybe you can create a second entity attached to the first and just above it and attach the camera to the second entity. I haven't tried it yet myself.
@threads I took one of my projects and modified it to attach a camera to one of the objects. Tap the attach parameter to attach or release the camera. I still haven't been able to alter the camera position relative to the object.
PS. Added code to allow the attached camera to be rotated using the parameter sliders.
Yes, i managed to attach the camera to an entity (I was confused before, the camera is a component, not an entity) but I didn’t find a way to move it relatively from the entity itself, so I ended up moving my camera independently in my update/draw function
@threads Here's an example of attaching the camera to an entity and move everything around the scene.
PS. I modified the code to use the tilt of the iPad to change the direction traveled.
Edit : this should be a tutorial or a default project ! (Minus the cube attached to the cam entity, which is not necessary, and would make the code even shorter)