Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 18,008 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
looking for suggestions on a problem #307422
01/29/10 07:57
01/29/10 07:57
Joined: Dec 2009
Posts: 71
N
ncc1701d Offline OP
Junior Member
ncc1701d  Offline OP
Junior Member
N

Joined: Dec 2009
Posts: 71
looking for suggestions. I am trying to get a box aka ball from lite-c tutorials to kind of hover and bob up and down slightly like a lottery ball in air popper.
What I have so far is below. I think I get an intial z force of 3710 but then nothing. I thought by alternating a zforce value and loop it. It would work. Any ideas for solving this problem?

#include <acknex.h>
#include <default.c>
#include <atypes.h>

VECTOR box_force;
ENTITY* box;
var a;

action balance()
{

while(1)
{
a = integer(random(2));
if(a == 1)
{
box_force.z = 0;
}
else
{
box_force.z = 3710;//initial jolt of vertice force comes from here I believe
}
wait(-1);
}

}

function main()
{

level_load("roller.wmb");//
box = ent_create("box.mdl", vector(-386, 0, 100), balance); // create the ball
/////////////////////////////////////////////////////////////////////////////////
ph_setgravity (vector(0, 0, -200)); //this line makes the ball drop
phent_settype(box, PH_RIGID, PH_BOX);//fine
phent_setmass(box, 2, NULL);//fine
phent_addcentralforce (box, box_force);
camera.x = 300;
camera.y = 300;
camera.z = 300;
camera.tilt = -20;
camera.pan = 214;

}

Re: looking for suggestions on a problem [Re: ncc1701d] #307426
01/29/10 09:36
01/29/10 09:36
Joined: Sep 2009
Posts: 496
P
Progger Offline
Senior Member
Progger  Offline
Senior Member
P

Joined: Sep 2009
Posts: 496
hi in the while loop u must put a wait(1);
not a wait(-1);
WFG programmer laugh


asking is the best Way to get help laugh laugh laugh
Re: looking for suggestions on a problem [Re: Progger] #307555
01/29/10 23:08
01/29/10 23:08
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
you need to keep the wait(-1);// i gues you want to change it random every sec

you need somewhere else a loop

while(bpx == NULL){wait(1);)
while(box != NULL)
{
phent_addcentralforce (box, box_force);
wait(1);
}


(and you need to be sure that your box_force x and y are 0 else he could trip and move far far away)


"empty"

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

Gamestudio download | 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