Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
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
0 registered members (), 1,498 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Physics on exact coordinates #303770
01/01/10 20:51
01/01/10 20:51
Joined: Jul 2008
Posts: 128
Ukraine
BastovBros Offline OP
Member
BastovBros  Offline 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 smile
Re: Physics on exact coordinates [Re: BastovBros] #303780
01/01/10 23:35
01/01/10 23:35
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline
Serious User
Scorpion  Offline
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
you have to deactivate the physic(phent_settype(me, NULL, NULL)) when you want to set it to a specific position - if it's there you can start it again. Then there shouldn't be an impact of any kind to that new created object

Re: Physics on exact coordinates [Re: Scorpion] #303800
01/02/10 10:09
01/02/10 10:09
Joined: Jul 2008
Posts: 128
Ukraine
BastovBros Offline OP
Member
BastovBros  Offline OP
Member

Joined: Jul 2008
Posts: 128
Ukraine
Thx Scorpion, I'll try it right away.
Though this question is a bit off-topic, it's still about physics. I noticed that there exists some kind of a physical bounding box around a physical object with PH_BOX. But the size (scale) of this box does not differ depending on the size of the phys object. And when this object is very small this box does not allow other entities to get close to the phys object. when I make it bigger again, I can move other entities closer. For my game I need to keep the phys object small, but the box is very annoying, is there a way to change its scale? to make it smaller?


a generator of dull questions smile
Re: Physics on exact coordinates [Re: BastovBros] #303856
01/03/10 00:41
01/03/10 00:41
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline
Serious User
Scorpion  Offline
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
maybe you didn't set the bounding box of the entity - by using c_setminmax, min_x, max_x or the BBox flag in WED- so that it still has its default size. You should check that...

Re: Physics on exact coordinates [Re: Scorpion] #303906
01/03/10 18:37
01/03/10 18:37
Joined: Jul 2008
Posts: 128
Ukraine
BastovBros Offline OP
Member
BastovBros  Offline OP
Member

Joined: Jul 2008
Posts: 128
Ukraine
no, it's not a bounding box... I have both c_setminmax and all the stuff and it's visible after f11 is pressed twice. It's something different, I am curious about the size of the box when flag PH_BOX is set for a physical object. I think it is the physical box, but its size dows not change....


a generator of dull questions smile
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 Offline OP
Member
BastovBros  Offline 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:
Code:
action fly(){
player = me;
the code....
}


Now I create the entity in main function and apply the same action to it, like this:
Code:
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:
Code:
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 smile
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 Offline OP
Member
BastovBros  Offline 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"
Code:
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:
Code:
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 smile

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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