[SOLVED] I need something like ”chaseCamera.getLocation/.getPosition()”

hey monkeys,

i’d like to attach a spotLight to my chaseCam:

i already made it point at the player :


(yeh, thats nothing special :smiley: )

but i cant figure out how to get the Position of the camera itself. I know, that I could get it to work with vector calculations etc. but my brain is in hollyday-mode so i don’t even get it done this way.

maybe somebody already got a method “chaseCamera.getPosition()” written himself and is willing to post it here.


Chase cam is attached to a spatial, so its location is the location of the spatial.

:smiley: what a picture… probably thats why im not an artist:


alright. so this is what i want to do:

i want a spotLight, which has the Position of my chaseCam (blue dot) and it should point at the spatial (red dot).


when i move my camera arround my character theres always a side, without light(sword/shield/… is simply black) so i want a weak light source to light up the side of my character im “looking” at with the camera.


[java]AmbienLight someLight = new AmbientLight();

// set the light stuff


I’m seriously glad you want to help, but this is like:

Me: I want to go to spain.

You: Well in Itally is good weather, too.

i tried your suggestion, but:


only the character itself is lighted, not the attached items :frowning:


well i decided to go to spain but the east coast, so its closer to italy :smiley:

heres my sollution:

thou it should also work fine with spotLight i decided to go with a point light:

[java]pl = new PointLight();

pl.setPosition(new Vector3f(0,10,0));


[java]public void simpleUpdate(float tpf){

pl.setPosition(new Vector3f(((float)Math.cos(-chaseCam.getHorizontalRotation())*chaseCam.getDistanceToTarget())+player.getPhysicsLocation().x,((float)Math.sin(chaseCam.getVerticalRotation())*chaseCam.getDistanceToTarget())+player.getPhysicsLocation().y,((float)Math.sin(chaseCam.getHorizontalRotation())*chaseCam.getDistanceToTarget())+player.getPhysicsLocation().z));


to use this with a spotLight i’d also have to come up with a calculation for th curent player location (since only “direction” and not “look at” is supportet with spotLight), but this one works just fine for me and is less calculation for me AND the machine.