1 registered members (Akow),
1,365
guests, and 7
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
A little problem with bones.
#156229
09/22/07 10:02
09/22/07 10:02
|
Joined: Aug 2006
Posts: 96 Netherlands
Polypfreak1987
OP
Junior Member
|
OP
Junior Member
Joined: Aug 2006
Posts: 96
Netherlands
|
I have an entity wich can move up and down with the tilt move by using 2 different keys. The problem is that I want to move the entity with one key. This is the code for the movement of the entity. Code:
my.skill15 = max(my.skill15,-15); my.skill15 = min(my.skill15,0); if(key_e == 1) { my.skill15 -= 0.5*time_step; } if(key_d == 1) { my.skill15 += 0.5*time_step; } ent_animate(my,NULL,0,0); ent_bonerotate(my,"arm_axis",vector(0,my.skill15,0));
You see that the keys e and d are used to move the entity. But I want to move the entity by only using the e button, so it is moving up and down. Is there a way to do something like that?
|
|
|
Re: A little problem with bones.
[Re: Nems]
#156231
09/22/07 19:22
09/22/07 19:22
|
Joined: Jul 2007
Posts: 959 nl
flits
User
|
User
Joined: Jul 2007
Posts: 959
nl
|
not sure but dont you need bone_reset()
"empty"
|
|
|
Re: A little problem with bones.
[Re: Nems]
#156232
09/22/07 20:05
09/22/07 20:05
|
Joined: Aug 2006
Posts: 96 Netherlands
Polypfreak1987
OP
Junior Member
|
OP
Junior Member
Joined: Aug 2006
Posts: 96
Netherlands
|
Quote:
Something like my.skill15 = 0.5 * (key_d-key_a) * Time_step;
No, it is not the result wat I want to have. The can compare the movement like you raise up your arm and bring it down. But the movement need to be in one key (the E-key). The code you gave me didn't gave any result, de entity stood at one place.
|
|
|
Re: A little problem with bones.
[Re: Polypfreak1987]
#156233
09/22/07 23:25
09/22/07 23:25
|
Joined: Apr 2007
Posts: 67
suriname0
Junior Member
|
Junior Member
Joined: Apr 2007
Posts: 67
|
Code:
my.skill15 = max(my.skill15,-15); my.skill15 = min(my.skill15,0); if(key_e == 1) { my.skill15 -= 1.0*time_step; } my.skill15 += 0.5*time_step; ent_animate(my,NULL,0,0); ent_bonerotate(my,"arm_axis",vector(0,my.skill15,0));
Is this what you were thinking of? It should stay at 15, unless the user presses and holds the E key. Then it will go back up (when released).
If I am posting, it probably means I am asking a question. Or faking my knowledge by agreeing with somebody else.
|
|
|
Re: A little problem with bones.
[Re: suriname0]
#156234
09/23/07 06:14
09/23/07 06:14
|
Joined: Aug 2006
Posts: 96 Netherlands
Polypfreak1987
OP
Junior Member
|
OP
Junior Member
Joined: Aug 2006
Posts: 96
Netherlands
|
Quote:
Code:
my.skill15 = max(my.skill15,-15); my.skill15 = min(my.skill15,0); if(key_e == 1) { my.skill15 -= 1.0*time_step; } my.skill15 += 0.5*time_step; ent_animate(my,NULL,0,0); ent_bonerotate(my,"arm_axis",vector(0,my.skill15,0));
Is this what you were thinking of? It should stay at 15, unless the user presses and holds the E key. Then it will go back up (when released).
Almost perfect But is there a way to put the E button one and that there will be a loop to such a movement? So the user don't need to push the E button every time?
|
|
|
Re: A little problem with bones.
[Re: Polypfreak1987]
#156235
09/23/07 14:59
09/23/07 14:59
|
Joined: Apr 2007
Posts: 67
suriname0
Junior Member
|
Junior Member
Joined: Apr 2007
Posts: 67
|
Yeah. In fact, there was a problem like this one a week or so ago. Something like this, if I recall... Code:
var inc; var status_accel = 0; define speed, skill2; function change_speed() { status_accel = 0; wait(1); my = player; status_accel = 1; if(my.speed <= 0) { inc = 1; } else { inc = -1; } while(status_accel) { my.speed += 0.1 * inc * time_step; if(my.speed >= 3 || my.speed <= 0) { status_accel = 0; } wait(1); } }
Obviously, it doesn't solve your problem. But you should be able to pick that apart to get a solution. Good practice, anyways. (btw, It shouldn't be hard to alter to get it to turn around at the top without another key press.)
If I am posting, it probably means I am asking a question. Or faking my knowledge by agreeing with somebody else.
|
|
|
Re: A little problem with bones.
[Re: suriname0]
#156236
10/06/07 06:31
10/06/07 06:31
|
Joined: Aug 2006
Posts: 96 Netherlands
Polypfreak1987
OP
Junior Member
|
OP
Junior Member
Joined: Aug 2006
Posts: 96
Netherlands
|
This code didn't work. Although I editted the script so that it was good to me. Yesterday I had to come on a idea to animate the entity with a bone. It worked for nouw, but I don't understand a thing in the manual. I use ent_animate to move it. But I don't know how it exactly works. The bone that I have attached to my model have the name "arm_axis" in MED. Should the code be like this? Code:
ent_animate(my,"arm_axis",my.tilt,ANM_CYCLE)
|
|
|
Re: A little problem with bones.
[Re: Polypfreak1987]
#156237
10/06/07 12:23
10/06/07 12:23
|
Joined: Aug 2006
Posts: 96 Netherlands
Polypfreak1987
OP
Junior Member
|
OP
Junior Member
Joined: Aug 2006
Posts: 96
Netherlands
|
Quote:
This code didn't work. Although I editted the script so that it was good to me.
Yesterday I had to come on a idea to animate the entity with a bone. It worked for nouw, but I don't understand a thing in the manual.
I use ent_animate to move it. But I don't know how it exactly works.
The bone that I have attached to my model have the name "arm_axis" in MED.
Should the code be like this?
Code:
ent_animate(my,"arm_axis",my.tilt,ANM_CYCLE)
I fixed this by myself. But now I have another problem.
On the entity that moves now correctly with the bone animation I have attached another entity wich doesn't work with bones. But that model rotates around (with the pan-method), but it need also tilt with the arm (the model wich have the bone animation). These two movements doesn't work anymore.
Before I used the bone-method on the main model (the arm) it worked correctly. But now doesn't.
Here is the code of the arm (The model wich have the bone-animation) Code:
action arm1 { arm_1 = my; my.passable = on; vec_for_vertex(temp,my,87); ent_create("kruis.mdl",temp, kruis1); while(my) { vec_for_vertex(temp, machine, 235); my.x = temp.x; my.y = temp.y; my.z = temp.z; my.pan = machine.pan +90;
my.scale_x = 1.7; my.scale_y = 1.7; my.scale_z = 1.7; if(key_e == on) { my.skill15 += 1.5*time_step; } ent_animate(my,NULL,0,0); ent_animate(my,"move",my.skill15,ANM_CYCLE); wait(1); } }
And here is the code of the model wich I want to rotate under the right angle. Code:
action kruis1 { kruis_1 = my; my.passable = on; while(1) { vec_for_vertex(temp, arm_1, 87); my.x = temp.x; my.y = temp.y; my.z = temp.z-4; my.scale_x = 0.7; my.scale_y = 0.7; my.scale_z = 0.7; my.roll =- kruis_1.roll; my.tilt = arm_1.skill15; my.pan -= arm_1.pan; my.pan += cross; if(key_w == 1.2) { if(cross < 1) { cross += 0.015*time_step; } } if(key_s == 1) { if(cross > 0) { cross -= 0.015*time_step; } } c_rotate(my, vector(arm_1.pan,arm_1.skill15,0), USE_AXIS); wait(1); } }
I hope you know what I doing wrong.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|