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
bitmap between two vectors #305849
01/17/10 20:23
01/17/10 20:23
Joined: May 2008
Posts: 2,113
NRW/Germany
alibaba Offline OP
Expert
alibaba  Offline OP
Expert

Joined: May 2008
Posts: 2,113
NRW/Germany
hi there, one more qquestion. grin
can someone give me a script example, where i can place a bitmap between two objects, i mean :
if i click with the mouse on a place, and then click to an other place, then the bitmpa should be created between this two vectors.
i hope you understand what i mean


german:
hallo, gibt es einen weg, das eine bitmap dort platziert wird, wo ich hinclicke?
also ich meine das so:
ich klicke wo hin dann klicke icxh wo anders hin, dann wird die bitmap von der start position zur endposition hin positioniert.
ich hoffe, ihr versteht was ich meine.


Professional Edition
A8.47.1
--------------------
http://www.yueklet.de
Re: bitmap between two vectors [Re: alibaba] #305851
01/17/10 20:38
01/17/10 20:38
Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
would that be an 2d bitmap(panel) or an 3d sprite? also, do you want to be that bitmap in the middle of these vectors or stretched between them?


3333333333
Re: bitmap between two vectors [Re: Quad] #305852
01/17/10 20:43
01/17/10 20:43
Joined: May 2008
Posts: 2,113
NRW/Germany
alibaba Offline OP
Expert
alibaba  Offline OP
Expert

Joined: May 2008
Posts: 2,113
NRW/Germany
it could be 2d or 3d, its your choise, and it should be streched between them.


Professional Edition
A8.47.1
--------------------
http://www.yueklet.de
Re: bitmap between two vectors [Re: alibaba] #305857
01/17/10 21:07
01/17/10 21:07
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Use vec_lerp to set it in the middle between both positions,
vec_dist goves you the distance between the two positions to scale the bitmap according, the example from the manual

function look_at_me()
{
vec_to_angle(camera.pan,vec_diff(NULL,my.x,camera.x));
}
shows you the way how to turn the bitmap, but you have to multiply the angle, if you use a simple bitmap. Maybe, vec_scale(bitmap.pan, 90); is sufficiant, I didn'z test it. You can make a model with the bitmap as plane in the middle of it.

These are just some hints, I still leave you the rest to code! wink

Re: bitmap between two vectors [Re: Pappenheimer] #305956
01/18/10 17:21
01/18/10 17:21
Joined: May 2008
Posts: 2,113
NRW/Germany
alibaba Offline OP
Expert
alibaba  Offline OP
Expert

Joined: May 2008
Posts: 2,113
NRW/Germany
++++QUADRAXAS+++++
i need your code please.


Professional Edition
A8.47.1
--------------------
http://www.yueklet.de
Re: bitmap between two vectors [Re: alibaba] #305958
01/18/10 17:33
01/18/10 17:33
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Do you have a click code already? Or, has he to write everything from scratch? wink

Re: bitmap between two vectors [Re: alibaba] #305959
01/18/10 17:34
01/18/10 17:34
Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
i thought what pappenheimer posted was sufficent but if you still can't do it ill post a code

(edit: im not gonna code clikcing, just stretching a bmap between 2 vectors.)

Last edited by Quadraxas; 01/18/10 17:34.

3333333333
Re: bitmap between two vectors [Re: Quad] #305963
01/18/10 17:42
01/18/10 17:42
Joined: May 2008
Posts: 2,113
NRW/Germany
alibaba Offline OP
Expert
alibaba  Offline OP
Expert

Joined: May 2008
Posts: 2,113
NRW/Germany
ok


Professional Edition
A8.47.1
--------------------
http://www.yueklet.de
Re: bitmap between two vectors [Re: alibaba] #305967
01/18/10 18:23
01/18/10 18:23
Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
Code:
#include <acknex.h>
#include <default.c>
void stretch_sprite(ENTITY* sprite,VECTOR* vec1,VECTOR* vec2){
	VECTOR temp;
	
	
	//calculating the scale factor, its distance_between_vectors/sprite_length; 
	//f.e. if sprite is 10 quants and the distance is 100 quants scale factor is 10, so when i scale sprite 10 times i get the desired length
	var scale_factor = vec_dist(vec1,vec2)/sprite.skill1;
	sprite.scale_x = scale_factor;
	
	//finding the angles between vectors
	vec_set(temp,vec1);
	vec_sub(temp,vec2);
	vec_to_angle(sprite.pan,temp);
	//apperantly, sprites stand prep. to x so add 90 to pan. 
	//do not directly add 90 to pan or you'll screw up the other amgles
	ang_rotate(sprite.pan,vector(90,0,0));
	
	//center of the sprite is on the middle, so ew have to move our new long sprite to middle of the vectors
	vec_lerp(temp,vec1,vec2,0.5);//temp now stores the middle of the vectors
	vec_set(sprite.x,temp);
}


void sprite_act(){
	//i only need to calculate these once, so insted of doing it in stretch_sprite function i do it here
	my.skill1 = my.max_x-my.min_x;//this stores the sprites original length
}

void sphere_act(){
	ENTITY* ent_sprite = ent_create("sprite.tga",nullvector,sprite_act);
	while(!ent_sprite) wait(1);
	my.skill1 = 0;
	my.skill2 = 1;
	while(1){
		//sphere movement
		my.pan += 10*time_step;
		my.skill1 += my.skill2*time_step;
		my.x -= my.skill1*cos(my.pan)*time_step;
		my.y += my.skill1*sin(my.pan)*time_step;
		my.z = 100*sin(my.pan);
		if(my.skill1>=10) my.skill2 = -1;
		else if(my.skill1<=-10) my.skill2 = 1;
		
		stretch_sprite(ent_sprite,my.x,nullvector);
		
		wait(1);
	}
}

void main(){
	wait(1);
	level_load("");
	ent_create("sphere.mdl",nullvector,sphere_act);
}



make a sprite.tga and run (i made a 16x16 blue image)

what you need is "stretch_sprite" function, dont mind the other parts, they are just some dirty code for demonstration purposes.


3333333333
Re: bitmap between two vectors [Re: Quad] #305974
01/18/10 18:58
01/18/10 18:58
Joined: May 2008
Posts: 2,113
NRW/Germany
alibaba Offline OP
Expert
alibaba  Offline OP
Expert

Joined: May 2008
Posts: 2,113
NRW/Germany
Thanks grin
MUCH THNAKS!


Professional Edition
A8.47.1
--------------------
http://www.yueklet.de

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