Gamestudio Links
Zorro Links
Newest Posts
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
1 registered members (AndrewAMD), 1,089 guests, and 2 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
Page 1 of 2 1 2
Ragdoll has no gravity #298780
11/17/09 19:12
11/17/09 19:12
Joined: Jul 2009
Posts: 150
B
Blackchuck Offline OP
Member
Blackchuck  Offline OP
Member
B

Joined: Jul 2009
Posts: 150
The Ragdoll worked good till I added (mystymoon).
Now it still works but there is no more gravity, I used for the grafity;
"ph_setgravity(vector(0, 0, -1500));"

"http://dl8.rapidshare.de/files/48696949/682793447/shot_0.jpg"

(Post me for more information)
And wenn the grafity works, everybody can copy it in his own projeckt, the die function is called "die_soldier()"

And I will post here the ragdollscript, when it`s ok?;
_______________________________________________________________

#define PRAGMA_PATH "scripts"
#define PRAGMA_PATH "models"
#define PRAGMA_PATH "textures"//for level (mystymood)

#include <acknex.h>
#include <default.c>
#include "level.c"// (mystymood)

#define PRAGMA_PATH "body_dummy";

STRING* level_str = "level.wmb";

VECTOR Hinge1, Hinge2;

var GroupID = 2;
var low_rot_dist = 5;

function die_soldier();

void updateBoneHinge(ENTITY* hingeEnt, STRING* bodyPart, ENTITY* actor) {
VECTOR temp_pos, temp_ang, temp_mov, temp_ang_1;

ENTITY* hingePointer = hingeEnt;
ENTITY* actorPointer = actor;
STRING* updatePart = bodyPart;

while(hingePointer) {

ent_bonereset(actorPointer, updatePart);

vec_for_bone(temp_pos, actorPointer, updatePart);
ang_for_bone(temp_ang, actorPointer, updatePart);

vec_set(temp_mov, hingePointer.x);
vec_sub(temp_mov, temp_pos);

temp_mov.x = actorPointer.scale_x; temp_mov.y = actorPointer.scale_y; temp_mov.z = actorPointer.scale_z;
temp_ang.x = 360-temp_ang.x; temp_ang.y = 360-temp_ang.y; temp_ang.z = 360-temp_ang.z;

vec_set(temp_ang_1, nullvector);
ang_add(temp_ang_1, vector(temp_ang.x,0,0));
ang_add(temp_ang_1, vector(0,temp_ang.y,0));
ang_add(temp_ang_1, vector(0,0,temp_ang.z));

ang_rotate(temp_ang_1, hingePointer.pan);
ent_bonerotate(you, updatePart, temp_ang_1);

wait(1);
}
}

void setLimit(VECTOR* vec1, VECTOR* vec2) {
vec_set(Hinge1, vec1);
vec_set(Hinge2, vec2);
}

void BodyPartInit(var mass, ENTITY* entityMe) {
set(entityMe, PASSABLE);

entityMe.pan = 180;

phent_settype(entityMe, PH_RIGID, PH_BOX);
phent_setmass(entityMe, mass, PH_BOX);

phent_setgroup(entityMe, GroupID);
phent_setfriction(entityMe, 40);
phent_setdamping(entityMe, 40, 40);
phent_setelasticity(entityMe, 10, 10);

reset(entityMe, PASSABLE);
}

void setHinge(ENTITY* constr_1, ENTITY* constr_2) {
var tempHinge;

tempHinge = phcon_add(PH_HINGE, constr_1, constr_2);
phcon_setparams1(tempHinge, constr_1.x, Hinge1, nullvector);
phcon_setparams2(tempHinge, Hinge2, nullvector, nullvector);
}

void setRagdollPart() {
set(my, INVISIBLE);
}

function die_soldier() {
ENTITY* Ent_1;
ENTITY* Ent_2;
ENTITY* Ent_3;

GroupID += 1;

var tempVertex;

you = ent_create("dummy.mdl.", nullvector, NULL);
set(you, PASSABLE);

Ent_1 = my;
setRagdollPart();
BodyPartInit(20, Ent_1);
setHinge(Ent_1, Ent_1);

vec_for_vertex(tempVertex, Ent_1, 23);
Ent_2 = ent_create("leg_up_left.mdl", tempVertex, setRagdollPart);
setLimit(vector(1,1,1), vector(-40,40,0));
BodyPartInit(5, Ent_2);
setHinge(Ent_2, Ent_1);
updateBoneHinge(Ent_2, "leg_up_left", you);

vec_for_vertex(tempVertex, Ent_2, 9);
Ent_3 = ent_create("leg_down_left.mdl", tempVertex, setRagdollPart);
setLimit(vector(0,1,0), vector(0,120,0));
BodyPartInit(20, Ent_3);
setHinge(Ent_3, Ent_2);
updateBoneHinge(Ent_3, "leg_down_left", you);

vec_for_vertex(tempVertex, Ent_1, 22);
Ent_2 = ent_create("leg_up_right.mdl", tempVertex, setRagdollPart);
setLimit(vector(1,1,1), vector(-40,40,0));
BodyPartInit(5, Ent_2);
setHinge(Ent_2, Ent_1);
updateBoneHinge(Ent_2, "leg_up_right", you);

vec_for_vertex(tempVertex, Ent_2, 9);
Ent_3 = ent_create("leg_down_right.mdl", tempVertex, setRagdollPart);
setLimit(vector(0,1,0), vector(0,120,0));
BodyPartInit(20, Ent_3);
setHinge(Ent_3, Ent_2);
updateBoneHinge(Ent_3, "leg_down_right", you);

vec_for_vertex(tempVertex, Ent_1, 21);
Ent_2 = ent_create("abs.mdl", tempVertex, setRagdollPart);
setLimit(vector(1,1,0), vector(-15,15,0));
BodyPartInit(20, Ent_2);
setHinge(Ent_2, Ent_1);
updateBoneHinge(Ent_2, "stomach", you);

vec_for_vertex(tempVertex, Ent_2, 17);
Ent_1 = ent_create("torso.mdl", tempVertex, setRagdollPart);
setLimit(vector(1,1,0), vector(-20,20,0));
BodyPartInit(55, Ent_1);
setHinge(Ent_1, Ent_2);
updateBoneHinge(Ent_1, "torso", you);

vec_for_vertex(tempVertex, Ent_1, 21);
Ent_2 = ent_create("arm_up_left.mdl", tempVertex, setRagdollPart);
setLimit(vector(1,1,1), vector(-70, 116,20));
BodyPartInit(5, Ent_2);
setHinge(Ent_2, Ent_1);
updateBoneHinge(Ent_2, "arm_up_left", you);

vec_for_vertex(tempVertex, Ent_2, 9);
Ent_3 = ent_create("arm_down_left.mdl", tempVertex, setRagdollPart);
setLimit(vector(1,1,0), vector(270,0,0));
BodyPartInit(20, Ent_3);
setHinge(Ent_3, Ent_2);
updateBoneHinge(Ent_3, "arm_down_left", you);

vec_for_vertex(tempVertex, Ent_1, 22);
Ent_2 = ent_create("arm_up_right.mdl", tempVertex, setRagdollPart);
setLimit(vector(1,1,1), vector(-70,116,20));
BodyPartInit(5, Ent_2);
setHinge(Ent_2, Ent_1);
updateBoneHinge(Ent_2, "arm_up_right", you);

vec_for_vertex(tempVertex, Ent_2, 9);
Ent_3 = ent_create("arm_down_right.mdl", tempVertex, setRagdollPart);
setLimit(vector(1,1,0), vector(270,0,0));
BodyPartInit(20, Ent_3);
setHinge(Ent_3, Ent_2);
updateBoneHinge(Ent_3, "arm_down_right", you);

vec_for_vertex(tempVertex, Ent_1, 23);
Ent_2 = ent_create("head.mdl", tempVertex, setRagdollPart);
setLimit(vector(1,1,0), vector(-45,45,0));
BodyPartInit(25, Ent_2);
setHinge(Ent_2, Ent_1);
updateBoneHinge(Ent_2, "head", you);

while(you) {
vec_set(you.x, my.x);
vec_set(you.pan, my.pan);

wait(1);
}
}

void main() {
vec_set(Hinge1, nullvector);
vec_set(Hinge2, nullvector);

video_screen = 1;
video_mode = 8;
fps_max = 100;
ph_iterations = 20;
time_smooth = 0.99;
clip_size = 0;
var max_entities = 5000;
terrain_chunk = 64;

wait(1);
level_load("test_level.wmb");
wait(3);
wait(-1);

ph_setgravity(vector(0, 0, -1500));
ph_setcorrections(9000, 0);
ph_setcollisions(1000, 2);
wait(1);
}

ENTITY* actor;

action ragdoll()
{
actor = me;
wait (1);
my.event = die_soldier();
}

Last edited by Blackchuck; 11/17/09 19:19.

I have know Gamestudio/A7 Commercial Edition 7.84
Re: Ragdoll has no gravity [Re: Blackchuck] #299523
11/24/09 16:31
11/24/09 16:31
Joined: Jan 2004
Posts: 3,023
The Netherlands
Helghast Offline
Expert
Helghast  Offline
Expert

Joined: Jan 2004
Posts: 3,023
The Netherlands
you need a hollow block around the level... also, this aint your code, it's mine, dont claim it's yours.


Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/
Re: Ragdoll has no gravity [Re: Helghast] #299539
11/24/09 18:30
11/24/09 18:30
Joined: Jul 2009
Posts: 150
B
Blackchuck Offline OP
Member
Blackchuck  Offline OP
Member
B

Joined: Jul 2009
Posts: 150
I didn`t saw that this code is from me, I sayèd "that code" not my code.

And is it realey from you? I got it out of the aum then I writen it alittlebit to an function (I think it was aum 83).

And why du I need a hollow block around the level to let the gravity work?

still thanks

Last edited by Blackchuck; 11/24/09 21:43.

I have know Gamestudio/A7 Commercial Edition 7.84
Re: Ragdoll has no gravity [Re: Blackchuck] #299591
11/25/09 08:28
11/25/09 08:28
Joined: Jan 2004
Posts: 3,023
The Netherlands
Helghast Offline
Expert
Helghast  Offline
Expert

Joined: Jan 2004
Posts: 3,023
The Netherlands
Yes, it's really mine, but dont worry wink

Anyway, it's a common made user-error that people dont have a huge hollow block around their level. I quote from the manual:

Quote:
Q: I don't get any gravity even though I set it via ph_setgravity at the beginning of the main function ?
A: Global physics parameters get reset when a new level is loaded. Thus you should first call level_load, wait 1 frame and then call ph_setgravity to set properties of the new level.


and also:

Quote:
Q: I've made a small level with only a few objects, and placed a ball into it. When I kick the ball into the air, it seems to hit an invisible barrier at some position.
A: Check the sky box around your level. The ball possibly collides with a side or the top of the sky box. If there is no sky box around your level at all, the level size is automatically limited to an area that contains all the objects. In this case, create a sky box in WED - a hollow cube with sky texture - and make it large enough for the ball to reach the desired height.


Hope that helps, good luck laugh
regards,


Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/
Re: Ragdoll has no gravity [Re: Helghast] #299838
11/27/09 13:44
11/27/09 13:44
Joined: Jul 2009
Posts: 150
B
Blackchuck Offline OP
Member
Blackchuck  Offline OP
Member
B

Joined: Jul 2009
Posts: 150
I works!
Thanks, thats very nice, just wright me if I can avenge wink


I have know Gamestudio/A7 Commercial Edition 7.84
Re: Ragdoll has no gravity [Re: Blackchuck] #300225
11/30/09 16:34
11/30/09 16:34
Joined: Jul 2009
Posts: 150
B
Blackchuck Offline OP
Member
Blackchuck  Offline OP
Member
B

Joined: Jul 2009
Posts: 150
I have just one more questin.
So action ragdoll worked;
________________________________________________________________________________
ENTITY* actor;

action ragdoll()
{
actor = me;
wait (1);
my.event = die_soldier();
}
________________________________________________________________________________

But why does this don`t work?;

________________________________________________________________________________

function collision();
VECTOR speed;

action free_camera()
{
player = my;
my.skill1 = 1;
my.emask |= (ENABLE_IMPACT | ENABLE_ENTITY | ENABLE_BLOCK);
c_setminmax(me);
my.event = collision;
while (my.skill1 == 1)
{
c_move (my, vector(10 * (key_w - key_s) * time_step, 6 * (key_a - key_d) * time_step, 0), nullvector, GLIDE);
camera.genius = me;
camera.pan -= 15 * mouse_force.x * time_step;
camera.tilt += 15 * mouse_force.y * time_step;
camera.x = player.x - 200;
camera.y = player.y;
camera.z = player.z + 20;
wait (1);
}
}

function collision()
{
wait(1);
my.skill1 = 0;
my.event = die_soldier();
}
________________________________________________________________________________

Whats wronge here?
thanks
greads


I have know Gamestudio/A7 Commercial Edition 7.84
Re: Ragdoll has no gravity [Re: Blackchuck] #300300
12/01/09 12:15
12/01/09 12:15
Joined: Jan 2004
Posts: 3,023
The Netherlands
Helghast Offline
Expert
Helghast  Offline
Expert

Joined: Jan 2004
Posts: 3,023
The Netherlands
I cant really see what you're trying to do?
can you explain that first laugh I'll try to help you through this then.

regards,


Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/
Re: Ragdoll has no gravity [Re: Helghast] #300369
12/01/09 18:50
12/01/09 18:50
Joined: Jul 2009
Posts: 150
B
Blackchuck Offline OP
Member
Blackchuck  Offline OP
Member
B

Joined: Jul 2009
Posts: 150
I just want that my action free_camera turns into an ragdoll wenn it touthes somthing.
Then when it works here I can use it everyware wink


I have know Gamestudio/A7 Commercial Edition 7.84
Re: Ragdoll has no gravity [Re: Blackchuck] #300389
12/01/09 22:35
12/01/09 22:35
Joined: Jan 2004
Posts: 3,023
The Netherlands
Helghast Offline
Expert
Helghast  Offline
Expert

Joined: Jan 2004
Posts: 3,023
The Netherlands
you're setting an even to another event, that wont work in this case tongue
change the my.event = collision; in free_camera function to my.event = die_soldier;

(also dont add () behind that die_soldier function, it will not work properly otherwise).

regards,


Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/
Re: Ragdoll has no gravity [Re: Helghast] #300605
12/03/09 17:39
12/03/09 17:39
Joined: Jul 2009
Posts: 150
B
Blackchuck Offline OP
Member
Blackchuck  Offline OP
Member
B

Joined: Jul 2009
Posts: 150
Oh... (up`s)
Thank, again wink


I have know Gamestudio/A7 Commercial Edition 7.84
Page 1 of 2 1 2

Moderated by  HeelX, Spirit 

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