Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
2 registered members (Quad, AndrewAMD), 1,007 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 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