Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 18,767 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
ray tracing problem for event #75309
05/24/06 13:22
05/24/06 13:22
Joined: Jun 2004
Posts: 6
H
hankiwan Offline OP
Newbie
hankiwan  Offline OP
Newbie
H

Joined: Jun 2004
Posts: 6
I programed some event function but there is some problem about ray trace.
Actually, I am using ray trace from camera position to the face of camera as below.
I am using only camera's pan and tilt.
In your think, is 'target_pos' correct?
I could found strange working that event occured on incorrect position of entity.
Is it entity's bounding box problem?
I made model entity using 3D MAX and the model is positioned on the origin of model editor.

please give me your expert solution~~



if(camera.pan < 0)
{ camera.pan += 360; }

if(camera.pan > 360)
{ camera.pan -= 360; }

if(camera.tilt < 0)
{ camera.tilt += 360; }

if(camera.tilt > 360)
{ camera.tilt -= 360; }



target_pos.x = camera.x + (cos(camera.pan) * cos(camera.tilt) * 1000);
target_pos.y = camera.y + (sin(camera.pan) * cos(camera.tilt) * 1000);
target_pos.z = camera.z + (sin(camera.tilt) * 1000);
//target_pos.z = camera.z + (cos(camera.pan) * sin(camera.tilt) * 1000);

trace_mode = ignore_me + ignore_maps + ignore_passable + ignore_passents + activate_shoot + use_box;
trace_distance = trace(camera.x, target_pos.x);

Re: ray tracing problem for event [Re: hankiwan] #75310
05/25/06 23:15
05/25/06 23:15
Joined: Aug 2005
Posts: 11
E
Engels Offline
Newbie
Engels  Offline
Newbie
E

Joined: Aug 2005
Posts: 11
Are you trying to trace from the camera to a position 1000 quants away in the same direction that it is pointing?

If so, you could try something like this:

var vecTgt[3];

vec_set(target_pos.x, camera.x);
vec_for_angle(vecTgt, camera.pan );
vec_scale(vecTgt, 1000);
vec_add(target_pos.x, vecTgt);


Moderated by  HeelX, Spirit 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1