|
find distance to closest object
#247570
01/21/09 16:53
01/21/09 16:53
|
Joined: May 2008
Posts: 331 Lithuania, Vilnius
Jaxas
OP
Senior Member
|
OP
Senior Member
Joined: May 2008
Posts: 331
Lithuania, Vilnius
|
Hi, does somebody know how to get distance between camera point and where you look (in fps)? or how to get point where you look.
The smaller the bug, the harder it is to kill. _________________________________________ Forklift DEMO (3dgs)
|
|
|
Re: find distance to closest object
[Re: Jaxas]
#247588
01/21/09 18:08
01/21/09 18:08
|
Joined: May 2008
Posts: 331 Lithuania, Vilnius
Jaxas
OP
Senior Member
|
OP
Senior Member
Joined: May 2008
Posts: 331
Lithuania, Vilnius
|
solve it, if somebody interested here's c_trace "to" vector: (camera.x+1000* cos (camera.pan),camera.y+1000* sin (camera.pan),camera.z+1000* sin (camera.tilt))
The smaller the bug, the harder it is to kill. _________________________________________ Forklift DEMO (3dgs)
|
|
|
Re: find distance to closest object
[Re: Jaxas]
#247676
01/22/09 03:46
01/22/09 03:46
|
Joined: Oct 2002
Posts: 2,256 Oz
Locoweed
Expert
|
Expert
Joined: Oct 2002
Posts: 2,256
Oz
|
solve it, if somebody interested here's c_trace "to" vector: (camera.x+1000* cos (camera.pan),camera.y+1000* sin (camera.pan),camera.z+1000* sin (camera.tilt)) That doesn't account for camera.tilt though, for that do something like:
vTemp.x = 1000;
vTemp.y = 0;
vTemp.z = 0;
vec_rotate(vTemp,camera.pan);
vec_add(vTemp,camera.x);
trace_mode = IGNORE_PASSABLE | IGNORE_PASSENTS | IGNORE_ME | IGNORE_SPRITES;
distance = c_trace(camera.x,vTemp,trace_mode);
Professional A8.30 Spoils of War - East Coast Games
|
|
|
|