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
4 registered members (degenerate_762, AbrahamR, AndrewAMD, ozgur), 667 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
attach weapon to player #178042
01/15/08 12:19
01/15/08 12:19
Joined: Dec 2005
Posts: 490
Germany/Berlin-Velten
kasimir Offline OP
Senior Member
kasimir  Offline OP
Senior Member

Joined: Dec 2005
Posts: 490
Germany/Berlin-Velten
Hello - i found this code to attach a weapon to the player... it works but sometimes it is not correct. The Code uses two vertex to orient the weapon, but i think if its possible to use tree vertes it will work fine! So Someone knows a better code???

Code:
 
while(player)
{
vec_for_vertex(temp.x,player,145);
vec_for_vertex(temp2.x,player,141);

vec_set(my.x,temp.x);
vec_diff(temp.x,temp2.x,temp.x);
vec_to_angle(temp.pan,temp.x);
vec_set(my.pan,temp.pan);

wait(1);
}



THX kasimir

Re: attach weapon to player [Re: kasimir] #178043
01/15/08 17:17
01/15/08 17:17
Joined: Sep 2006
Posts: 292
M
Mythran Offline
Member
Mythran  Offline
Member
M

Joined: Sep 2006
Posts: 292
You have to declare another temp... temp[3]
then vec_for_vertex(temp3.x,player,123) //or whatever the vertex is...

But you could just change the two vertex you have of the player hand
to fit better... no need for more vertex...

Re: attach weapon to player [Re: Mythran] #178044
01/15/08 18:53
01/15/08 18:53
Joined: Dec 2005
Posts: 490
Germany/Berlin-Velten
kasimir Offline OP
Senior Member
kasimir  Offline OP
Senior Member

Joined: Dec 2005
Posts: 490
Germany/Berlin-Velten
Thx but I definite need 3 vertex to change all angels of the weapon...
i know that i need 3 temp - vars ...
but i don't know how to calculate the angels exactly...

Re: attach weapon to player [Re: Mythran] #178045
01/15/08 18:53
01/15/08 18:53
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
dont know why you didt it but the .x isnt imported

Code:


while(player)
{
vec_for_vertex(temp,player,145);
vec_for_vertex(temp2,player,141);

vec_set(my.x,temp);
vec_sub(temp,temp2);
vec_to_angle(my.pan,temp);

//if its pan 180 to much
//vec_set(my.x,temp);
//vec_sub(temp2,temp);
//vec_to_angle(my.pan,temp2);


wait(1);
}




"empty"
Re: attach weapon to player [Re: flits] #178046
01/16/08 00:26
01/16/08 00:26
Joined: Sep 2003
Posts: 281
Arkansas\USA
raiden Offline
Member
raiden  Offline
Member

Joined: Sep 2003
Posts: 281
Arkansas\USA
Not sure if you saw this one I did awhile back, but the Customize Menu makes it pretty easy to set items up.

Attach Items

-raiden


"It doesn't matter if we win or lose, it's how we make the game."
--------------------
Links: 3DGS for Dummies
Re: attach weapon to player [Re: kasimir] #178047
01/16/08 05:37
01/16/08 05:37
Joined: Sep 2003
Posts: 281
Arkansas\USA
raiden Offline
Member
raiden  Offline
Member

Joined: Sep 2003
Posts: 281
Arkansas\USA
I don't see why you need 3 vertex's to change the angles, you would want to align the weapon origin to a single vertex position of the entity(like a vertex in it's right hand) and also update the weapons angles according to the entity's angles. All that's left to do is add some offsets to make it look correct if you are in 3rd person view.

If you look at the Custom Panel in the post, you will see I have offsets for x,y,z and pan, tilt, roll. You can adjust these offsets to "fine tune" the position and angle to the vertex.

I may be totally missing what your asking for, but check out the demo and see if that works for you.

-raiden


"It doesn't matter if we win or lose, it's how we make the game."
--------------------
Links: 3DGS for Dummies
Re: attach weapon to player [Re: raiden] #178048
01/16/08 09:48
01/16/08 09:48
Joined: Dec 2005
Posts: 490
Germany/Berlin-Velten
kasimir Offline OP
Senior Member
kasimir  Offline OP
Senior Member

Joined: Dec 2005
Posts: 490
Germany/Berlin-Velten
sry but that doesn't work the way i want!!! ... i want that the weapon rotates with the hand, that means pan, tilt and roll ... your script works with easy animations, but if he should attack it does not work fine, the weapon is faced to sky allways...

with two vertex's the gun i use allway have the same pan like the player, allthought the hand shows to the right!!!
so i need definite 3 Vertex's - one for the postion, and two to orient pan roll and tilt!!!

Re: attach weapon to player [Re: kasimir] #249305
02/01/09 17:39
02/01/09 17:39
Joined: May 2008
Posts: 62
México.
F
FcoElizalde Offline
Junior Member
FcoElizalde  Offline
Junior Member
F

Joined: May 2008
Posts: 62
México.
Hi kasimir
I dont know if you´d figured out already since last post was a year ago, but anyway, the answer to this question is in other thread:

v attach calculating roll?

Re: attach weapon to player [Re: FcoElizalde] #249337
02/01/09 20:56
02/01/09 20:56
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
That is the solution that i am looking for a long time. Will try it next week. Thanks a lot

Re: attach weapon to player [Re: Widi] #249500
02/02/09 21:21
02/02/09 21:21
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
It works !!! You are my hero


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