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
3 registered members (Grant, TipmyPip, AndrewAMD), 12,724 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
How do i adjust a c_trace vertical scanning angle? #144060
07/28/07 16:28
07/28/07 16:28
Joined: Aug 2006
Posts: 41
Racine, WI, USA
dreadFusemonkey Offline OP
Newbie
dreadFusemonkey  Offline OP
Newbie

Joined: Aug 2006
Posts: 41
Racine, WI, USA
I am setting up my player so that he sends out a sonar c_trace. I was under the impression that c_trace sends out a "laser" and not a "cone", but the results I am getting indicate it's tracing a vertical plane/cone. Side-to-side tracing works as expected - my sonar activated entities are triggered when the player's center of view enters the left or right of the entities. However, top-to-bottom seems to be disregarded. As long as the center of my player's view is between the left/right sides of an entity, even if the center of the view is above or below the entity, the sonar is triggered. I want it so it only triggers if the center of view is between left/right AND top/bottom.

Following is my player code for tracing:
Code:

VECTOR vTrace;
...
vec_set(vTrace.x,vector(1000,0,0));
vec_rotate(vTrace,vector(my.pan,0,0));
vec_add(vTrace, my.x);
c_trace(my.x, vTrace.x, IGNORE_ME | IGNORE_MAPS | ACTIVATE_SONAR );



What am I missing?

Thanks.


To crush your enemy...see them driven before you, and to hear da lamentation of da vimmen!
Re: How do i adjust a c_trace vertical scanning an [Re: dreadFusemonkey] #144061
07/29/07 01:00
07/29/07 01:00
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Code:
vec_rotate(vTrace,vector(my.pan,0,0));


should be replaced by
Code:
vec_rotate(vTrace,my.pan);



because when you use vector(my.pan,0,0), you completely disregard the tilt component of your angle. this means you can hit any entity on a similar z level to your player.

julz


Formerly known as JulzMighty.
I made KarBOOM!
Re: How do i adjust a c_trace vertical scanning an [Re: JibbSmart] #144062
07/29/07 04:04
07/29/07 04:04
Joined: Aug 2006
Posts: 41
Racine, WI, USA
dreadFusemonkey Offline OP
Newbie
dreadFusemonkey  Offline OP
Newbie

Joined: Aug 2006
Posts: 41
Racine, WI, USA
After stepping away from the keyboard for a few hours, the thought occurred to me that part of the problem is that my trace should be relative to where my player is looking, which means it should be more camera-centric than player-centric. So, after playing a bit I came up with this:

Code:

vec_set(vTrace.x,vector(1000,0,0)); // 1000 units forward
vec_rotate(vTrace,vector(my.pan,camera.tilt,0)); // same pan as player (seems more accurate than camera) and same tilt as camera.
vec_add(vTrace, camera.x);
c_trace(camera.x, vTrace.x, IGNORE_ME | IGNORE_MAPS | ACTIVATE_SONAR );



I kept the vec_rotate line the same except I added the "camera.tilt" to the vector() arguments. (When I tried "vec_rotate(vTrace,my.pan);" it still didn't work quite right).

I changed the vec_add() and the c_trace() lines to use camera.x instead of player.x


To crush your enemy...see them driven before you, and to hear da lamentation of da vimmen!
Re: How do i adjust a c_trace vertical scanning an [Re: dreadFusemonkey] #144063
07/29/07 04:17
07/29/07 04:17
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Quote:

(When I tried "vec_rotate(vTrace,my.pan);" it still didn't work quite right).


that's because, as you said, your player doesn't tilt with the camera.

julz


Formerly known as JulzMighty.
I made KarBOOM!
Re: How do i adjust a c_trace vertical scanning an [Re: JibbSmart] #144064
07/29/07 20:58
07/29/07 20:58
Joined: Aug 2006
Posts: 41
Racine, WI, USA
dreadFusemonkey Offline OP
Newbie
dreadFusemonkey  Offline OP
Newbie

Joined: Aug 2006
Posts: 41
Racine, WI, USA
roger that.

I changed it to ...

vec_rotate(vTrace,camera.pan);

... and it worked. much more streamlined than what i had. Thanks once again for your help.


To crush your enemy...see them driven before you, and to hear da lamentation of da vimmen!

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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