ambiera home ambiera home

Ambiera Forum

Discussions, Help and Support.

Create a new account, Search, or Login:
Name:  Password:
Ambiera Forum > CopperLicht
3rd person camera without Coppercube
Author Text

boxbee
Registered User
Quote
2013-01-08 06:26:36

How do you get the camera to follow an object? I have been trying to figure out how to do this without Coppercube. Is there a way to do this using only copperlicht?


niko
Moderator
Quote
2013-01-09 16:05:24

You can manually modify the position of the camera to follow the object you like.


boxbee
Registered User
Quote
2013-01-10 21:37:17

I've got the camera moving on the Z axis correctly. The issue is now with the X axis. When I try to position the camera it seems to rotate instead. The camera always seems to want to look at the center of the screen.

document.on keydown = function(event) {
var key = String.fromCharCode(event.keyCode);
if (key == 'W')
boxnode1.Pos.Z += 10;
if (key == 'S')
boxnode1.Pos.Z -= 10;
if (key == 'A'){
boxnode1.Pos.X -= 10;
cam.Pos.X -= 10; // <-- this is the issue
}
if (key == 'D')
boxnode1.Pos.X += 10;
cam.Pos.X += 10; // <-- this is the issue
}

cam.Pos.Z = boxnode1.Pos.Z - 100
engine.handleKeyDown(event);
}



niko
Moderator
Quote
2013-01-10 21:42:13

Yes, you also need to move the target position of the camera as well, if you want it to work like this. Otherwise it always stays looking at the same spot.


boxbee
Registered User
Quote
2013-01-11 09:12:28

It worked perfectly, thank you so much!


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Intern?tional" (you are not logged in)


Text:

 

  

Forum Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   





Software: Ambiera Light Forum. © 2008-2019 Nikolaus Gebhardt, Ambiera e.U.