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
Entitie vermitteln, aber in Bewegung bleiben #220265
08/06/08 17:55
08/06/08 17:55
Joined: Oct 2005
Posts: 612
Inari Offline OP
User
Inari  Offline OP
User

Joined: Oct 2005
Posts: 612
Hallo,
ich möchte dass ein Entitie immer mittig zwischen dem Blauen und
den Roten bleibt egal wie sie sich von einander entfernen,
wie es auf den beiden Bildern zu erkennen ist.



von der Seite gesehen


von oben

Re: Entitie vermitteln, aber in Bewegung bleiben [Re: Inari] #220266
08/06/08 18:03
08/06/08 18:03
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
Don't speak german sry, don't know if you can read english but...

Can't you set the vectors of each object, and find halfway between it and then set this vector to the centre entity.

Don't know if this is the way to go, just a guess.

Re: Entitie vermitteln, aber in Bewegung bleiben [Re: DJBMASTER] #220277
08/06/08 19:07
08/06/08 19:07
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
Hallo, wie gehts!

I don't speak german either but you've gotta love http://ets.freetranslation.com/

English!
Code:
function setCentre(localEnt1,localEnt2){
	me=localEnt1; you=localEnt2;

	var vec1; var vec2;

	//stores the positions into vectors
	vec_set(vec1,my.x);
	vec_set(vec2,your.x);

	//gets the centre of the 2 positions
	vec_set(temp,my.x);
	vec_add(temp,your.x);
	vec_scale(temp,0.5);

	//set the objects position
	vec_set(ball.x,temp); //name of you entity

	//sets the obejcts position
	vec_set(temp,vec1);
	vec_sub(temp,vec2);
	vec_to_angle(ball.pan,temp);
}

function main(){
	//entities to find the centre of
	setCentre(blue_player,red_player);
}


Deutsch ?
Code:
function setCentre(localEnt1,localEnt2){
	me=localEnt1; you=localEnt2;

	var vec1; var vec2;

	//Speichert die Positionen in Vektoren
	vec_set(vec1,my.x);
	vec_set(vec2,your.x);

	//Erhält die Mitte von den 2 Positionen
	vec_set(temp,my.x);
	vec_add(temp,your.x);
	vec_scale(temp,0.5);

	//Setzt die Objekte einstellen
	vec_set(ball.x,temp); //name of you entity

	//Setzt die obejcts Position
	vec_set(temp,vec1);
	vec_sub(temp,vec2);
	vec_to_angle(ball.pan,temp);
}

function main(){
	//Wesen, die Mitte von
	setCentre(blue_player,red_player);
}


Hope this helps
Hofft, dass dies hilft

Re: Entitie vermitteln, aber in Bewegung bleiben [Re: MrGuest] #220281
08/06/08 19:22
08/06/08 19:22
Joined: Jan 2007
Posts: 221
F
Fenriswolf Offline
Member
Fenriswolf  Offline
Member
F

Joined: Jan 2007
Posts: 221
There is also a short version:
Code:
/* places the green entity between the red entity and the blue entity */
vec_lerp(green_entity.x, red_entity.x, blue_entity.x, 0.5);


Re: Entitie vermitteln, aber in Bewegung bleiben [Re: Fenriswolf] #220285
08/06/08 19:29
08/06/08 19:29
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
Originally Posted By: Fenriswolf
There is also a short version:
Code:
/* places the green entity between the red entity and the blue entity */
vec_lerp(green_entity.x, red_entity.x, blue_entity.x, 0.5);


vec_lerp eh? LERP!!! what kind of words LERP!!! stupid lerp... good to know though! wink

Re: Entitie vermitteln, aber in Bewegung bleiben [Re: MrGuest] #220774
08/09/08 11:31
08/09/08 11:31
Joined: Oct 2005
Posts: 612
Inari Offline OP
User
Inari  Offline OP
User

Joined: Oct 2005
Posts: 612
ja hat es, aber wie kann ich jetzt eigentlich den abstand zwischen dem Blauen und dem Roten ermitteln?

Re: Entitie vermitteln, aber in Bewegung bleiben [Re: Inari] #220779
08/09/08 12:29
08/09/08 12:29
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
The distance is simply:
distance = vec_dist(blue_entity.x,red_entity.x);

But thats just a value, not a vector or whatever.
So using vec_lerp to set the position of the green entity is the right way to go.
Or lets say, the easiest way

Re: Entitie vermitteln, aber in Bewegung bleiben [Re: Inari] #220905
08/10/08 18:44
08/10/08 18:44
Joined: Oct 2005
Posts: 612
Inari Offline OP
User
Inari  Offline OP
User

Joined: Oct 2005
Posts: 612
cool danke

Last edited by Inari; 08/11/08 17:48.

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