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
2 registered members (AndrewAMD, TipmyPip), 12,709 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
arrow pointing to next object/obstacle #281532
07/27/09 16:31
07/27/09 16:31
Joined: Mar 2009
Posts: 276
Cebu City, Philippines
boyax Offline OP
Member
boyax  Offline OP
Member

Joined: Mar 2009
Posts: 276
Cebu City, Philippines
In my 3rd person 3D game, I have here an arrow model that would point to the next obstacle in the level.
How it should be best implemented. Need some advise or reference. Thanks.

Re: arrow pointing to next object/obstacle [Re: boyax] #281533
07/27/09 16:35
07/27/09 16:35
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
This should do...

Code:
var temp[3];

// get the direction from the obstacle to the arrow...
vec_set(temp,obstacle.x); 
vec_sub(temp,arrow.x);
vec_to_angle(arrow.pan,temp); // now arrow points to obstacle



Re: arrow pointing to next object/obstacle [Re: DJBMASTER] #281593
07/27/09 19:50
07/27/09 19:50
Joined: Feb 2009
Posts: 84
Deutschland/Niedersachsen
GorNaKosh Offline
Junior Member
GorNaKosh  Offline
Junior Member

Joined: Feb 2009
Posts: 84
Deutschland/Niedersachsen
If your obstacles are models your can use c_scan with to find the next one. The event function could look like this:
Code:
ENTITY *nextObs == NULL;

void searchNextObs() {
     if(event_type == EVENT_SCAN) {
          if(nextObs == NULL) {
          nextObst = me;
          } else {
               if(vec_dist(nextObst.x,you.x) > vec_dist(me.x,you.x)) { //if this obstacle is closer to the scanning entity than the saved obstacle
               nextObs = me;
               }
          }
     }
}

action act_obstacle() {
my.emask = ENABLE_SCAN;
my.event = searchNextObs;
}




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