Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by Zheka. 06/20/24 14:26
Lapsa's very own thread
by rki. 06/19/24 11:27
A simple game ...
by VoroneTZ. 06/18/24 10:50
Face player all the time ...
by bbn1982. 06/18/24 10:25
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 692 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Mino, squik, AemStones, LucasJoshua, Baklazhan
19061 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
strange ball boucing in Earthball8 sample #427998
08/16/13 11:38
08/16/13 11:38
Joined: Aug 2011
Posts: 42
F
fabiomartins Offline OP
Newbie
fabiomartins  Offline OP
Newbie
F

Joined: Aug 2011
Posts: 42
Earthball8.c has a strange bouncing

here my compiled sample:
https://hotfile.com/dl/239911466/97b58c6/earthball8_teste.cd.zip.html


below my source code:
///////////////////////////////////////////////////////////////
// earthball8.c - physics example for lite-C pure mode
// lite-C version of the C++ SDK example in the manual
// (c) jcl / oP group 2010
///////////////////////////////////////////////////////////////
#include <default.c>
#include <ackphysx.h>

///////////////////////////////////////////////////////////////
// some global definitions

PANEL* pSplash = { bmap = "logo_800.jpg"; }

TEXT* tHelp = {
pos_x = 10; pos_y = 10;
font = "Arial#24bi";
flags = SHADOW;
string("Press [Space] to kick the blob!");
}

ENTITY* eBlob;

SOUND* sPong = "tap.wav";

VECTOR vSpeed, vAngularSpeed, vForce, vMove;

///////////////////////////////////////////////////////////////
// This is our event function for the ball impact.
function Plop()
{
// Play a ball impact sound.
ent_playsound(eBlob,sPong,100);
}

// Function for kicking the ball in camera direction.
function Kick()
{
// Create a local speed vector
VECTOR vKick;
// Use a horizontal and vertical speed to give the ball an upwards kick.
vKick.x = 150; vKick.y = 0; vKick.z = 75;
// Rotate it in camera direction.
vec_rotate(vKick,camera.pan);
// Now apply the speed to the ball, and play a hit sound.
pXent_addvelcentral(eBlob,vKick);
Plop();
}

///////////////////////////////////////////////////////////////
// If a function is named "main", it's automatically started
function main()
{
// Activate 800x600 screen resolution and stencil shadows,
// and set the sound at full volume.
// Video_mode and video_aspect can be set
// before initializig the video device during the first wait().
video_mode = 7;
video_aspect = 4./3.; // 4:3 monitor for 800x600
shadow_stencil = 3;
d3d_antialias = 4;
sound_vol = 100;
physX_open(); // use physics

// Make the splash screen visible.
set(pSplash,SHOW);

// After a panel is set to SHOW, we have to wait 3 frames
// until we can really see it on the screen.
// The first frame paints it into the background buffer,
// two more frames are needed until the background buffer
// is flipped to the front in a triple buffer system.
wait(3);

// Before we can create level entities, a level must be loaded.
level_load("small.hmp");

// create a sky cube on layer 0
ENTITY* sky = ent_createlayer("skycube+6.dds", SKY | CUBE | SHOW, 0);
// lift the sky and the camera to get a better overview
sky.z = 30;
camera.z = 30;

// Let's now create a ball at position (0,0,100).
// The vector function converts 3 floats to a temporary var vector
// for passing positions to engine functions.
eBlob = ent_create("bola_brazuca.mdl",vector(0,0,100),NULL);
// Set an entity flag to cast a dynamic shadow
set(eBlob,SHADOW);
// Use one of the default materials for giving it a shiny look
eBlob.material = mat_metal;

// Now let's set the blob's physical properties.
pXent_settype(eBlob,PH_RIGID,PH_SPHERE);
pXent_setelasticity(eBlob,80);
pXent_setdamping(eBlob,20,5);

// We add a small speed to give it a little sidewards kick.
pXent_addvelcentral(eBlob,vector(10,10,0));

// Activate an event: if the blob hits something, a sound shall be played.
// We set the event function and the collision flag for triggering
// EVENT_FRICTION event at collisions with the level.
pXent_setcollisionflag(eBlob,NULL,NX_NOTIFY_ON_START_TOUCH);
eBlob.event = Plop;

// Remove the splash screen and display the text.
pan_remove(pSplash);
set(tHelp,SHOW);

// We want to kick the ball by hitting the [Space] key.
// Assign the 'Kick' function to the on_space event.
on_space = Kick;

// play the sound as if someone had kicked the ball into play
Plop();

// During the main loop we're just moving the camera
while (1)
{
// For the camera movement we use the
// vec_accelerate() function. It accelerates a speed and
// is not dependent on the frame rate - so we don't need to
// limit the fps in this example. This code is equivalent
// to the built-in camera movement, but uses different keys.
vForce.x = -5*(key_force.x + mouse_force.x); // pan angle
vForce.y = 5*(key_force.y + mouse_force.y); // tilt angle
vForce.z = 0; // roll angle
vec_accelerate(vMove,vAngularSpeed,vForce,0.8);
vec_add(camera.pan,vMove);

vForce.x = 6 * (key_w - key_s); // forward
vForce.y = 6 * (key_a - key_d); // sideward
vForce.z = 6 * (key_home - key_end); // upward
vec_accelerate(vMove,vSpeed,vForce,0.5);
vec_rotate(vMove,camera.pan);
vec_add(camera.x,vMove);
wait(1);
}

// We don't need to free our created entities, bitmaps and sounds.
// The engine does this automatically when closing.
}
///////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////


somebody can help me ? please

Re: strange ball boucing in Earthball8 sample [Re: fabiomartins] #428000
08/16/13 11:52
08/16/13 11:52
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
"Earthball8.c has a strange bouncing"
Explain in more detail, what is the problem?


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: strange ball boucing in Earthball8 sample [Re: Superku] #428002
08/16/13 12:07
08/16/13 12:07
Joined: Aug 2011
Posts: 42
F
fabiomartins Offline OP
Newbie
fabiomartins  Offline OP
Newbie
F

Joined: Aug 2011
Posts: 42
sorry my english is bad frown

unreal physic event on ball
the ball is kicking every time

Re: strange ball boucing in Earthball8 sample [Re: fabiomartins] #428003
08/16/13 12:14
08/16/13 12:14
Joined: Aug 2011
Posts: 42
F
fabiomartins Offline OP
Newbie
fabiomartins  Offline OP
Newbie
F

Joined: Aug 2011
Posts: 42
The ball never stop on this Physx example and keep kicking

when I use "A7 Phent_" physics functions
the example works fine....

Re: strange ball boucing in Earthball8 sample [Re: fabiomartins] #428005
08/16/13 12:41
08/16/13 12:41
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Uh I don't know, sorry.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: strange ball boucing in Earthball8 sample [Re: Superku] #428285
08/22/13 21:26
08/22/13 21:26
Joined: Feb 2010
Posts: 886
Random Offline
User
Random  Offline
User

Joined: Feb 2010
Posts: 886
Remove:
Code:
// We add a small speed to give it a little sidewards kick. 
pXent_addvelcentral(eBlob,vector(10,10,0));



I believe that is what you don`t want.



Re: strange ball boucing in Earthball8 sample [Re: Random] #436994
02/07/14 11:55
02/07/14 11:55
Joined: Mar 2005
Posts: 68
Baesweiler
Tele Offline
Junior Member
Tele  Offline
Junior Member

Joined: Mar 2005
Posts: 68
Baesweiler
Hallo
This is a Problem.

// Activate an event: if the blob hits something, a sound shall be played.
// We set the event function and the collision flag for triggering
// EVENT_FRICTION event at collisions with the level.
pXent_setcollisionflag(eBlob,NULL,NX_NOTIFY_ON_START_TOUCH);
eBlob.event = Plop;

Why only goes the event once?
olso with NX_NOTIFY_ON_TOUCH.
The Kollisionsevent stops after a time.
Is this a Bug?

Re: strange ball boucing in Earthball8 sample [Re: Tele] #437066
02/08/14 17:41
02/08/14 17:41
Joined: Mar 2005
Posts: 68
Baesweiler
Tele Offline
Junior Member
Tele  Offline
Junior Member

Joined: Mar 2005
Posts: 68
Baesweiler
Hallo
Ok the problem is
you cant sett NULL of this function.

pXent_setcollisionflag(eBlob, NULL, NX_NOTIFY_ON_START_TOUCH);

you must realy set the second entitie zb. bump of your terrain.

you = ent_for_name ("terrain_001"); // get pointer to that entity
pXent_setcollisionflag(my,you,NX_NOTIFY_ON_END_TOUCH);
my.event = Plop;

Then its work fine. ;-)

Tele


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