Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AbrahamR, wdlmaster, 7th_zorro, dr_panther, 1 invisible), 764 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Print Thread
Rate Thread
Page 1 of 2 1 2
any better way to attach turret to the tankbody? #306924
01/25/10 20:30
01/25/10 20:30
Joined: Nov 2008
Posts: 196
the wrong place
Muhsin Offline OP
Member
Muhsin  Offline OP
Member

Joined: Nov 2008
Posts: 196
the wrong place
Hi!

when i attach my turret to my tank body i do like this:

my.x = you.x;
my.y = you.y;
my.z = you.z;
my.tilt = you.tilt;
my.roll = you.roll;

it works fine, as long as i don't turn the turret, i can go up mountains and all that, but if i turn the turret and try to drive up mountains, then my turret tilts different then the tankbody.

so i wanted to ask: is there any other way to attach the turret to the tankbody and don't get problems like this?

thanks for the helps!

- Muhsin Kaymak


Come and play my new browsergame - Valley Of Wolves:

http://www.mafiacreator.com/ValleyOfWolves

Hurry and be the first to take over the different business' in the Valley Of Wolves, before anybody else does it!
And be the most feared MafiaBoss in the World!!
Re: any better way to attach turret to the tankbody? [Re: Muhsin] #306927
01/25/10 20:37
01/25/10 20:37
Joined: Sep 2009
Posts: 496
P
Progger Offline
Senior Member
Progger  Offline
Senior Member
P

Joined: Sep 2009
Posts: 496
hi download aum21 and look at thanks thats a game with a tank and a turret
WFG programmer


asking is the best Way to get help laugh laugh laugh
Re: any better way to attach turret to the tankbody? [Re: Progger] #306929
01/25/10 21:05
01/25/10 21:05
Joined: Nov 2008
Posts: 196
the wrong place
Muhsin Offline OP
Member
Muhsin  Offline OP
Member

Joined: Nov 2008
Posts: 196
the wrong place
Hi

i looked at the code, but it doesn't tell how to make the turret tilt the same way the tankbody gets tilt, when i drives up the "mountains"


thanks!


- Muhsin Kaymak


Come and play my new browsergame - Valley Of Wolves:

http://www.mafiacreator.com/ValleyOfWolves

Hurry and be the first to take over the different business' in the Valley Of Wolves, before anybody else does it!
And be the most feared MafiaBoss in the World!!
Re: any better way to attach turret to the tankbody? [Re: Muhsin] #306931
01/25/10 21:32
01/25/10 21:32
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
I have this Code to attach a Weapon to a Player. Maybee you can use it for your Project:

Code:
VECTOR Vertex_pos_1
VECTOR Vertex_pos_2
VECTOR Vertex_pos_3
VECTOR Vertex_norm
VECTOR Vertex_ebene_1
VECTOR Vertex_ebene_2
VECTOR Vertex_roll

void SETZE_ANGEH_GST(vertex_1,vertex_2,vertex_3,plus_pan,plus_tilt,plus_roll)
{
	proc_mode = PROC_LATE;
	
	vec_for_vertex (Vertex_pos_1,you,vertex_1);                                                     // Hole Vertex - Positionen
	vec_for_vertex (Vertex_pos_2,you,vertex_2);
	vec_for_vertex (Vertex_pos_3,you,vertex_3);
	
	vec_for_normal (Vertex_norm,you,vertex_2);
	vec_add (Vertex_norm,Vertex_pos_2);
	
	vec_set (my.x, Vertex_norm);                                                                    // Set my Position to vertex_2
	
	vec_sub(Vertex_pos_1,Vertex_pos_2);                                                             // Set pan and tilt
	vec_to_angle(my.pan,Vertex_pos_1);
	my.pan  += plus_pan;
	my.tilt += plus_tilt;
	
	my.roll = 0;		                                                                              // Set roll
	vec_sub(Vertex_pos_2,Vertex_pos_3);
	
	vec_set (Vertex_ebene_1, vector(0,1,0));	
	vec_rotate (Vertex_ebene_1, my.pan);
	
	vec_set (Vertex_ebene_2, vector(0,0,1));	
	vec_rotate (Vertex_ebene_2, my.pan);                                                            // This Vectors set the plane	
	
	Vertex_roll.x = vec_dot (Vertex_ebene_1, Vertex_pos_2);	
	Vertex_roll.y = vec_dot (Vertex_ebene_2, Vertex_pos_2);
	
	vec_to_angle (Temp_ang1, Vertex_roll);
	my.roll = Temp_ang1.pan + plus_roll;
}


Call this function in a while loop. The vertex_1 - vertex_3 are 3 vertices in position of a "L" at the tank, where do you want to set your turret. Play with the vars pan_plus.

EDIT: Or a easier way: Use a bone at the Position where you want add your turrent, set the turrent with vec_for_bone and ang_for_bone, and turn your turrent with ent_bonerotate

Last edited by Widi; 01/25/10 21:44.
Re: any better way to attach turret to the tankbody? [Re: Widi] #307000
01/26/10 15:12
01/26/10 15:12
Joined: Nov 2008
Posts: 196
the wrong place
Muhsin Offline OP
Member
Muhsin  Offline OP
Member

Joined: Nov 2008
Posts: 196
the wrong place
Hi Widi!

i tried to do like this:

vec_for_bone(turretcoord, your, "turret");
ang_for_bone(turretang, your, "turret");
vec_set(my.x, turretcoord.x);

the first part with the vec_for_bone works with vec_set, but i don't know how to end the ang_for_bone code, how do i do?

thanks!


- Muhsin Kaymak


Come and play my new browsergame - Valley Of Wolves:

http://www.mafiacreator.com/ValleyOfWolves

Hurry and be the first to take over the different business' in the Valley Of Wolves, before anybody else does it!
And be the most feared MafiaBoss in the World!!
Re: any better way to attach turret to the tankbody? [Re: Muhsin] #307001
01/26/10 15:17
01/26/10 15:17
Joined: Nov 2008
Posts: 196
the wrong place
Muhsin Offline OP
Member
Muhsin  Offline OP
Member

Joined: Nov 2008
Posts: 196
the wrong place
OK!, found the problem. Thank you very much for the helps!!!

thanks!


- Muhsin Kaymak


Come and play my new browsergame - Valley Of Wolves:

http://www.mafiacreator.com/ValleyOfWolves

Hurry and be the first to take over the different business' in the Valley Of Wolves, before anybody else does it!
And be the most feared MafiaBoss in the World!!
Re: any better way to attach turret to the tankbody? [Re: Muhsin] #307003
01/26/10 15:21
01/26/10 15:21
Joined: Nov 2008
Posts: 196
the wrong place
Muhsin Offline OP
Member
Muhsin  Offline OP
Member

Joined: Nov 2008
Posts: 196
the wrong place
Now i got another problem, it works, but if i turn the turret, then it tilts the wrong way??

thanks!


- Muhsin Kaymak


Come and play my new browsergame - Valley Of Wolves:

http://www.mafiacreator.com/ValleyOfWolves

Hurry and be the first to take over the different business' in the Valley Of Wolves, before anybody else does it!
And be the most feared MafiaBoss in the World!!
Re: any better way to attach turret to the tankbody? [Re: Muhsin] #307004
01/26/10 15:32
01/26/10 15:32
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
You use the ent_bonerotate for that? I never uses Bones in my Projects, but i think that should help...

Re: any better way to attach turret to the tankbody? [Re: Widi] #307010
01/26/10 15:47
01/26/10 15:47
Joined: Nov 2008
Posts: 196
the wrong place
Muhsin Offline OP
Member
Muhsin  Offline OP
Member

Joined: Nov 2008
Posts: 196
the wrong place
yea, sorry, i forgot to use the ent_bonerotate..

now it works!!

thanks!!


- Muhsin Kaymak


Come and play my new browsergame - Valley Of Wolves:

http://www.mafiacreator.com/ValleyOfWolves

Hurry and be the first to take over the different business' in the Valley Of Wolves, before anybody else does it!
And be the most feared MafiaBoss in the World!!
Re: any better way to attach turret to the tankbody? [Re: Muhsin] #307212
01/27/10 20:40
01/27/10 20:40
Joined: Jun 2004
Posts: 2,234
Wisconsin USA
FoxHound Offline
Expert
FoxHound  Offline
Expert

Joined: Jun 2004
Posts: 2,234
Wisconsin USA
You should post the code that works so when other people search the forums they can see your solution.


---------------------
There is no signature here.


QUIT LOOKING FOR ONE!
Page 1 of 2 1 2

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