Camera Component, cc.follow question

Hi,

I have the following:

Canvas size : 1280 x 720
Camera Node on the Screen - Player Node as Target
Touch Node Layer to move player
Background Node Sprite: 6000 x 6000
Player Node

The thing is that when I move my player off the canvas, it’s not visible, even though I have a Camera Component on the screen and the target is the player node? Am I missing something…? Would really appreciate help…Thanks and God Bless…

Sincerely,

Sunday

The targets property of Camera component is not the following target, it’s the render target.

So anything put into targets will be rendered by the Camera. In your case you should put both player and background nodes into targets and write a script to update camera position so it can follow player.

Hi @nantas,

Thanks for the help…I’ve attached a cc.follow script to the camera component, like below:

properties: {
player:{
default:null,
type:cc.Node
}
},

FollowPlayer:function(){
var followAction = cc.follow(this.player);
this.node.runAction(followAction);
},

But nothing…??? God Bless…

Sincerely,

Sunday

cc.follow is not very compatible with the new camera.

You should check out this camera example project, it contains script that handles all kinds of camera control:

Hi @nantas

Thank you…God Bless…

Sincerely,

Sunday