Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 947 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 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,210
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

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