Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 01:28
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Ayumi), 838 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 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 | chip programmers | 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