Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
1 registered members (AndrewAMD), 599 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: vec_for_vertex, vec_diff and angle?! [Re: ] #271659
06/14/09 10:51
06/14/09 10:51
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655
The code sample offered by Widi seems related to an older C-Script (.wdl) code sample found on AU resources.
new_Vattach_with_roll.zip
So if C-Script (.wdl) is being used...

Of course, that might not be relevant at all.

Re: vec_for_vertex, vec_diff and angle?! [Re: testDummy] #271686
06/14/09 13:08
06/14/09 13:08
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Must be an initial offset rotation Im not taking into account.
Try this then...
Code:
action attach_knife2
{
   weapon = 1;
   weapon1 = me;
   vec_set(my.skill10, my.pan);   //save initial orientation
   proc_late();
   my.passable = on; 
   while (player != null)
   {
      vec_set (my.x, my.skill1); 
      vec_for_vertex (my.skill1, player, 1550); //palm
      vec_for_vertex (my.skill4, player, 1589); //vertex that separates thumb and the pointer finger
      vec_to_angle (my.pan, vec_diff (NULL, my.skill4, my.skill1)); 
      ang_add(my.pan, my.skill10);
      wait (1);
    .....





"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: vec_for_vertex, vec_diff and angle?! [Re: EvilSOB] #271687
06/14/09 13:20
06/14/09 13:20

C
chris_oat
Unregistered
chris_oat
Unregistered
C



realy big thanks for ur help, but wen i try ur code, it always gives me an empty pointer error... (Vec to angle)
but i can feel we are close ..

EDIT:
well i try a little around. no empty pointer if i use "while (player == null)" instead of "while (player != null)". but now the gun not appear in the player hands, its somewhere stuck in the level smile
omg... smile

Last edited by chris_oat; 06/14/09 13:27.
Re: vec_for_vertex, vec_diff and angle?! [Re: ] #271691
06/14/09 13:37
06/14/09 13:37
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Maybe theres a lite-c/c-script difference there, Im more familiar with lite-c
Change the while to while(player) and change my line
vec_to_angle (my.pan, vec_diff (NULL, my.skill4, my.skill1));
to be
vec_diff(my.skill7, my.skill4, my.skill1)
vec_to_angle(my.pan, my.skill7);



"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: vec_for_vertex, vec_diff and angle?! [Re: EvilSOB] #271695
06/14/09 13:50
06/14/09 13:50

C
chris_oat
Unregistered
chris_oat
Unregistered
C



yep, closer
now the weapon is in his hands and no empty pointer.
but stil 180 degrees while aiming...
BUT wen i shoot, the gun now rotates with every shoot (pan)
maybe i post my whole code:
Code:
 
action attach_knife2
{
weapon = 1;
weapon1 = my;
vec_set(my.skill10, my.pan);   //save initial orientation
proc_late();
my.passable = on; 
while (player)
{
vec_set (my.x, my.skill1); 
vec_for_vertex (my.skill1, player, 1550); //palm
vec_for_vertex (my.skill4, player, 1589); //vertex that separates thumb and the pointer finger
vec_diff(my.skill7, my.skill4, my.skill1);
vec_to_angle(my.pan, my.skill7);
ang_add(my.pan, my.skill10);
wait (1);
if(mouse_left){
camera.x += random(1);
camera.y += random(1);
vec_for_vertex (temp.x, weapon1, 596);
ent_create (bullet_mdl, temp.x, move_bullets);ent_create (muzzle_pcx, temp.x, display_muzzle);
ent_create (muzzle_pcx, temp.x, display_muzzle);
}
if(mouse_left==0){trigger = 0;}
}
}


Last edited by chris_oat; 06/14/09 13:51.
Re: vec_for_vertex, vec_diff and angle?! [Re: ] #271738
06/14/09 19:28
06/14/09 19:28
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
Use the Code from testDummy, it is the same as my code but in C-Script....

Re: vec_for_vertex, vec_diff and angle?! [Re: Widi] #271781
06/15/09 02:47
06/15/09 02:47
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Try getting rid of all my 'skill10' stuff, and replace my
ang_add(my.pan, my.skill10);
line with
my.roll = player.pan; //or -player.pan
and see if it gives any improvements.

Even if it does, depending an your player animations it may still go flakey sometimes.
I think you'll need to go for one of the three-vertex versions if the players
arm moves a lot during the animations.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: vec_for_vertex, vec_diff and angle?! [Re: EvilSOB] #271817
06/15/09 08:22
06/15/09 08:22

C
chris_oat
Unregistered
chris_oat
Unregistered
C



yep, more better, now the weapon dont just turn 180 degrees, now it turns all the plyer turn, but too fast not sync to the player, is there a line i can add like do half speed only?! like
my.roll = player.pan * 0.5 time.speed ????
something like that ?!

Last edited by chris_oat; 06/15/09 08:23.
Re: vec_for_vertex, vec_diff and angle?! [Re: ] #271876
06/15/09 14:28
06/15/09 14:28
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
I have NO idea why its rotating twice as much, unless my
ang_add(my.pan, my.skill10); is still in there.
It should be deleted!

Otherwise, try my.roll = player.pan / 2;.
But this is only a guess.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: vec_for_vertex, vec_diff and angle?! [Re: EvilSOB] #271990
06/15/09 23:40
06/15/09 23:40
Joined: Oct 2008
Posts: 513
Carlos3DGS Offline
User
Carlos3DGS  Offline
User

Joined: Oct 2008
Posts: 513
Nice code, may I add it to my project?


"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1
Page 2 of 2 1 2

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