Gamestudio Links
Zorro Links
Newest Posts
Zorro version 3.0 prerelease!
by jcl. 02/12/26 14:05
MarginCost discrepancy?
by jcl. 02/12/26 14:02
Hedge on FXCM, 4 or 5?
by qin. 02/11/26 14:12
CMC MT4 CFD vs FX Active - what's better?
by mayarik. 02/11/26 11:00
print a "still alive" log
by qin. 02/10/26 12:16
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (TipmyPip), 7,787 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
ApprenticeInMuc, PatrickH90, USER0328, Sfrdragon, mayarik
19198 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
point towards #266201
05/16/09 16:22
05/16/09 16:22
Joined: Apr 2009
Posts: 141
dakilla Offline OP
Member
dakilla  Offline OP
Member

Joined: Apr 2009
Posts: 141
is there a way to make one entity pan towards another entity?


One day there will be an unfixable bug,
That day is not today.
Re: point towards [Re: dakilla] #266204
05/16/09 16:53
05/16/09 16:53
Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
yes,find direction vector from target entity to looking entity (vec_sub their positions)

then use vec_to_angle to convert that vector to angle. use the pan of resulting angle.


3333333333
Re: point towards [Re: Quad] #266205
05/16/09 16:55
05/16/09 16:55
Joined: Apr 2009
Posts: 141
dakilla Offline OP
Member
dakilla  Offline OP
Member

Joined: Apr 2009
Posts: 141
kk, thanks


One day there will be an unfixable bug,
That day is not today.
Re: point towards [Re: dakilla] #266217
05/16/09 18:56
05/16/09 18:56
Joined: May 2008
Posts: 331
Lithuania, Vilnius
Jaxas Offline
Senior Member
Jaxas  Offline
Senior Member

Joined: May 2008
Posts: 331
Lithuania, Vilnius
Code:
function turn_towards_target()
{
  // get the direction from the entity MY to the entity YOU
  vec_set(temp,your.x); 
  vec_sub(temp,my.x);
  vec_to_angle(my.pan,temp); // now MY looks at YOU
}

from manual..again..


The smaller the bug, the harder it is to kill.
_________________________________________
Forklift DEMO (3dgs)
Re: point towards [Re: dakilla] #266317
05/17/09 13:21
05/17/09 13:21
Joined: Mar 2006
Posts: 321
Norway
Eagelina Offline
Senior Member
Eagelina  Offline
Senior Member

Joined: Mar 2006
Posts: 321
Norway
Go and download and read AUM 72,
in the unanswered question the last one, is a great code that works as you whant.


A6 and A7 Commercial
-------------------
Programmer always searching for more to learn and understand. smile

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