I built a very simple camera that follows a box, and its working almost perfectly BUT
between the angle [54 to 126] and [234 to 306], the box disappears :S
so in rad that would be (with
That has happened to me when I did not update the model bounds of the object I was looking at.
It still doesn't work
unless i have to do something other than:
player.setModelBound(new BoundingBox());
player.updateModelBound();
I'm still new so I wouldn't be surprise if I simply forgot to put a random line somewhere -_-
I also tried adding some random box, and they also disappears depending on the angle I look at them, so I'm guessing i fail at learning to bound my object correctly
u r setting up the bounding correctly.
have u tried modify the near and far plane of the camera? it could be that the box is too close to the camera that its getting culled.
I wasn't able to modify the frustum to get it to work however, i added
System.out.println(cam.contains(player.getWorldBound()));
to see if it was suppose to see it
Result: when i have that pintln, i can always see the box and it works perfectly, as soon as i remove it, it keeps on disappearing from time to time.
I'm even more confused now :P
that is indeed very weird, maybe some developers can shine some light on this
I kinda had a similar problem and I used some camera normalize code I found on the forum. And that sorted the problem for me. Heres the thread: http://www.jmonkeyengine.com/jmeforum/index.php?topic=3431.0
still doesn't work :S
I cannot help you with your particluar problem, but if you have not checked this out yet, you might want to take a look at Lex’s StrategicHandler library. The source is available and he has also a camera, following an object.
Here is the project: Google code StrategicHandler
Ty, gonna go look at it
cam.setLocation(player.getLocalTranslation().add(
-10*(float)Math.sin(direction*FastMath.DEG_TO_RAD,
5,
-10*(float)Math.cos(direction*FastMath.DEG_TO_RAD));
Is this doing anything funky with the player translation, or would this be better
cam.setLocation(player.getLocalTranslation().clone().add(
-10*(float)Math.sin(direction*FastMath.DEG_TO_RAD,
5,
-10*(float)Math.cos(direction*FastMath.DEG_TO_RAD));
add method shouldnt modify the player translation only addLocal does. so the clone shouldnt be necessary.
I didn't think so, but wanted to make sure.