Change the camera point of view to follow

I want the camera above the shoulders of each animal so as the animal walks, so your view is constantly over the head of the animal. I’ve spent more time trying different solutions than I want to admit.

It’s misleading to say the camera is following the animal. You can’t move an object, animal or otherwise, via the keyboard or mouse. You’re controlling the camera movement in space. So this code actually makes the animal follow the camera. It’s present the appearance of the camera following the animal.

I present three different possible solutions. The one that is most ideal is camTiger. It’s not perfect though because you have to turn of the camera collision.

CoSpaces gurus…
Can the camLion be coded to ignore collisions with charLion but react to other collisions?
How about creating a Follow mode, like there is a Walk and Fly?

Here’s the space https://cospac.es/i50q

1 Like

Hi @MrWolken,

Ignoring collisions on certain items for the camera is only possible via scripting right now. To do so, you can use this script:

//Find the item to be added to the collision filter
const myCharacter = Scene.getItem("charTiger");

//Add the item to the collision filter
Scene.camera.addToCollisionFilter(myCharacter)

Below is a remixable space which expands on your camTiger concept. Feel free to check out the scripts used in the space to learn how it was done. Let me know if you have any questions :slight_smile:

This is what I was looking for!

Question:

  1. Does the script runs automatically when the space is launched?
  2. Can the script called from inside CoBlocks?
  3. If a script can be called, can it be passed/return values like a function can?
  4. What internal CoBlocks commands are you not sharing? i.e. CallScript[scriptname]

Thanks for a great platform!

Hi @MrWolken,

  1. All scripts run automatically after “Play” has been pressed

  2. Custom scripts can not be called from within CoBlocks by design. We’d like to make sure that all CoBlocks remain functional after app-updates. If we notice certain functionality (such as ignoring collision of certain items) being requested often, we’ll consider adding it as advanced CoBlock.

  3. You can define functions in scripting which can return values. However, taking a value from a script and using it in CoBlocks can’t be done right now.

  4. Our internal CoBlocks are for debugging purposes only, so rest assured we’re not hiding any CoBlocks from you :slight_smile:

1 Like