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
3 registered members (AndrewAMD, The_Judge, Grant), 898 guests, and 5 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
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,209
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,209
İ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 | 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