Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PyGTK Track Editor - Round 2
03-28-2008, 10:35 AM,
#14
 
It turns out my additive texture calls do work as expected. It's the camera code that's screwed up. The camera is not looking at the object when it's selected.

I've committed my changes to svn. The selected object should have a redish tone.

Now I need help on the camera math. This is the code to position the camera,
Code:
obj_pos = vdrift.VERTEX(pyobj.model.jmodel.GetBBOX().GetCenter())
    cam_pos = vdrift.VERTEX(obj_pos)
    cam_pos.x -= 20
    cam_pos.y += 10
    cam_pos.z -= 20
    vdrift.game.cam.SetPosition(cam_pos)
    vdrift.game.cam.dir.LookAt(cam_pos.x, cam_pos.y, cam_pos.z, obj_pos.x, obj_pos.y, obj_pos.z, 0,1,0)
What it does is take the object's bounding box center as object position, and add some offset to get the camera position. Then cam.dir.LookAt() is called to point the camera at the object. From my test, the camera is not exactly pointing at the object though.

So,

1. How do we decide the camera position? Ideally, it should not be too near nor too far. And it should not be obstructed by other objects.

2. Is there anything wrong in the above code to calculate camera direction?
Reply


Messages In This Thread
PyGTK Track Editor - Round 2 - by rookie1 - 03-26-2008, 11:04 AM
[No subject] - by joevenzon_phpbb2_import3 - 03-26-2008, 02:29 PM
Re: PyGTK Track Editor - Round 2 - by alex25 - 03-26-2008, 03:30 PM
Re: PyGTK Track Editor - Round 2 - by rookie1 - 03-26-2008, 08:35 PM
[No subject] - by rookie1 - 03-26-2008, 09:03 PM
[No subject] - by thelusiv - 03-26-2008, 11:51 PM
[No subject] - by rookie1 - 03-27-2008, 08:13 AM
[No subject] - by thelusiv - 03-27-2008, 11:37 AM
[No subject] - by rookie1 - 03-27-2008, 11:39 AM
[No subject] - by alex25 - 03-27-2008, 06:44 PM
[No subject] - by rookie1 - 03-27-2008, 09:32 PM
[No subject] - by alex25 - 03-27-2008, 09:54 PM
[No subject] - by rookie1 - 03-28-2008, 10:35 AM
[No subject] - by alex25 - 03-28-2008, 01:46 PM
[No subject] - by alex25 - 03-28-2008, 05:53 PM
[No subject] - by joevenzon_phpbb2_import3 - 03-28-2008, 07:51 PM
[No subject] - by rookie1 - 03-29-2008, 10:28 AM
[No subject] - by joevenzon_phpbb2_import3 - 03-30-2008, 01:27 PM
[No subject] - by rookie1 - 04-04-2008, 08:57 AM
[No subject] - by joevenzon_phpbb2_import3 - 04-04-2008, 10:26 AM
[No subject] - by joevenzon_phpbb2_import3 - 04-04-2008, 10:12 PM
[No subject] - by rookie1 - 04-08-2008, 11:24 AM
[No subject] - by alex25 - 04-08-2008, 01:21 PM
[No subject] - by rookie1 - 04-09-2008, 10:21 AM
[No subject] - by rookie1 - 04-22-2008, 10:32 AM
[No subject] - by alex25 - 04-22-2008, 01:26 PM
[No subject] - by rookie1 - 04-22-2008, 10:43 PM
[No subject] - by alex25 - 04-23-2008, 01:28 AM
[No subject] - by rookie1 - 04-28-2008, 09:31 AM
[No subject] - by joevenzon_phpbb2_import3 - 04-29-2008, 01:58 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)