|
1 registered members (AndrewAMD),
599
guests, and 3
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
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
testDummy
Serious User
|
Serious User
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.zipSo 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
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Must be an initial offset rotation Im not taking into account. Try this then...
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
|
chris_oat
Unregistered
|
chris_oat
Unregistered
|
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  omg... 
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
Expert
|
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
|
chris_oat
Unregistered
|
chris_oat
Unregistered
|
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:
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: Widi]
#271781
06/15/09 02:47
06/15/09 02:47
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
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
|
chris_oat
Unregistered
|
chris_oat
Unregistered
|
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
Expert
|
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
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|