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
3 registered members (AndrewAMD, TipmyPip, OptimusPrime), 15,359 guests, and 7 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
Physics in a MiniGolf Game #189533
03/19/08 17:27
03/19/08 17:27
Joined: May 2007
Posts: 46
R
ribsribs Offline OP
Newbie
ribsribs  Offline OP
Newbie
R

Joined: May 2007
Posts: 46
Greetings!

I've decided to learn a bit more about 3DGS Physics engine, and for that i've thinked in a simple game: A minigolf game.

I was testing the basic features and my physics concept fails around the force/torque/velocity functions.

I've tried searching the forum, the english posts, and i couldn't find anything elucidative. (so sorry if i'm making a "double post")

Now for the problem:
Imagine a MiniGolf game.
You have the power of the stroke and the direction of the stroke.
Assuming that the stroke power is variable based, let's assign strokepwr=100.
The direction of the stroke is given by the position of another entity outside the physic's rigid collection.

I've tried a bunch of variations with phent_addforceglobal but the ball keeps acting berserk.

So, how can i apply a force to the ball, with a strokepwr of 100, towards another entity?

(i understand that an entity with physics assigned cannot be panned, rolled, tilted or moved)

Thanks a lot in advance!
Rib

Re: Physics in a MiniGolf Game [Re: ribsribs] #189534
03/19/08 18:54
03/19/08 18:54
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
the best thing you could use is:
phent_addvelcentral(my,vector(strokepwr,0,0));
i think
also you could use

phent_addcentralforce ( ENTITY*, VECTOR* vForce );
phent_addforceglobal (ENTITY* entity,VECTOR* vForce,VECTOR* vPos );
phent_addforcelocal (ENTITY* entity,VECTOR* vForce,VECTOR* vPos );
phent_addtorqueglobal ( entity, vecTorque );
phent_addvellocal
phent_addvelglobal


"empty"
Re: Physics in a MiniGolf Game [Re: flits] #189535
03/19/08 19:21
03/19/08 19:21
Joined: May 2007
Posts: 46
R
ribsribs Offline OP
Newbie
ribsribs  Offline OP
Newbie
R

Joined: May 2007
Posts: 46
Thanks for the reply and for the function to use advice...
...but:

I still need to head the force towards an entity
Any ideas?

Re: Physics in a MiniGolf Game [Re: ribsribs] #189536
03/19/08 22:01
03/19/08 22:01
Joined: May 2007
Posts: 46
R
ribsribs Offline OP
Newbie
ribsribs  Offline OP
Newbie
R

Joined: May 2007
Posts: 46
Solved it!

This is the solution i've came up with:
(it can help somebody with the same problem)
(fell free to correct my newbie errors I appreciate it )

vec_set(temp,GolfBall.x);
vec_sub(temp,BallHeader.x);
vec_to_angle(BallHeader.pan,temp);

phent_addvelcentral(GolfBall,vector(-temp.x*strokepower/50,-temp.y*strokepower/50,0));

strokepower it's "clamped" between 0 and 100.

Thanks for the tips flits

Last edited by ribsribs; 03/19/08 22:02.

Moderated by  HeelX, Spirit 

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