0 registered members (),
1,498
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Physics on exact coordinates
#303770
01/01/10 20:51
01/01/10 20:51
|
Joined: Jul 2008
Posts: 128 Ukraine
BastovBros
OP
Member
|
OP
Member
Joined: Jul 2008
Posts: 128
Ukraine
|
I create an entity in WED. The entity has physics functions. Then when the entity hits an obstacle it explodes and then should respawn near a certain level object, instead of removing and then creating the netity again, I move it to the coordinates near the level object vec_set(vector(entity.x,entity.y,entity.z),vector(lvl_obj.x,lvl_obj.y,lvl_obj.z + 50));. But when the entity is moved to the coordinates near the level object, the physics does not work properly again: the entity does not fall on the ground. It seems that something holds it in that coordinates and dows not allow it to fall. I though that it could be because of the loop. But I tried different variants and cannot come up with the proper one. I'll post my code later, don't have time now, but if you have any ideas how to make physics work again, please help. And I hope that it is possible to accomplish it without removing/creating the entity. Thx in advance
a generator of dull questions
|
|
|
Re: Physics on exact coordinates
[Re: BastovBros]
#303929
01/03/10 21:51
01/03/10 21:51
|
Joined: Jul 2008
Posts: 128 Ukraine
BastovBros
OP
Member
|
OP
Member
Joined: Jul 2008
Posts: 128
Ukraine
|
well... I decided to rewrite my script and instead of creating the player Entity in WED to create it in script with ent_create. I had an action applied to the player entity and it had a pointer:
action fly(){
player = me;
the code....
}
Now I create the entity in main function and apply the same action to it, like this:
action fly(){
player = me;
other code....
}
function main(){
other code...
ent_create("plane.mdl",vector(*,*,*), fly);//* means some coordinates
}
But I don't know why the pointer does not work properly and if "player" is used anywhere I have crashes, like I have two actions for other entities with player.x and player.pan parameters, but they crash. I looked through the manual and found how to make a pointer:
action fly(){
plane = me;
other code....
}
function main(){
other code...
ENTITY* plane = ent_create("plane.mdl",vector(*,*,*), fly);//* means some coordinates
}
and I replaced all player.x, player.pan and other stuff with plane.x, plane.pan and so on..., but I still have crashes in all other functions ans actions where the plane entity is used. The engine dows not show me the exact problems and the causes of crashes, but I guess it's the pointer. Maybe I don't describe the pointers properly. I have never created entities through ent_create, so I don't know how to make a pointer. Help please... Thx
Last edited by BastovBros; 01/03/10 21:51.
a generator of dull questions
|
|
|
Re: Physics on exact coordinates
[Re: BastovBros]
#303933
01/03/10 22:00
01/03/10 22:00
|
Joined: Jul 2008
Posts: 128 Ukraine
BastovBros
OP
Member
|
OP
Member
Joined: Jul 2008
Posts: 128
Ukraine
|
And btw, the other problem about pointers is that I don't know whether to write the action first or the main function first. If I write the main function first, I don't have error with the pointer but there is an error in action "no action found"
function main(){
ENTITY* plane = ent_create("plane.mdl",vector(*,*,*), fly);// no "fly" action found, because it goes after this code
}
action char1(){ // another action for another entity
my.x = plane.x; // no error here
}
action fly(){ //also tried function instead of action, the same result
plane = me; // no error here
}
Then I wrote the action before main function:
action char1(){ // this action must be before fly action, because som eof its parameters are used in fly action
my.x = plane.x; // error here, "plane" unknown variable
}
action fly(){
plane = me;
}
function main(){
ENTTIY* plane = ent_create("plane.mdl", vector(*,*,*), fly);//no error here
}
Help please, I don't know what to do in this situation and where to place the pointer..... Sorry for double post
Last edited by BastovBros; 01/04/10 08:15.
a generator of dull questions
|
|
|
|