Gamestudio Links
Zorro Links
Newest Posts
Zorro tutorial ideas?
by mistery. 09/19/26 17:09
Trades during a running bar
by Martin_HH. 09/18/26 12:45
Capital slider is not saving in Z12
by frutza. 09/17/26 13:36
Avoiding pop-up training parameter results
by Martin_HH. 09/16/26 21:31
What are you working on?
by rayp. 09/16/26 20:20
Future of ZorroHFT
by TipmyPip. 09/16/26 09:28
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
2 registered members (3run, ukgamer), 1,988 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
mistery, lokkalyansamiti, rahulbuilds, speedx, liop
19236 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