Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,280 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
[Help] football script that can kick a Long pass? #62292
01/19/06 04:26
01/19/06 04:26
Joined: Oct 2003
Posts: 206
N
nkl Offline OP
Member
nkl  Offline OP
Member
N

Joined: Oct 2003
Posts: 206
Hi
I ue A6 PRO version 6.31.4
How do I change following football script that can kick a Long pass, loop pass, through pass effect?
Code:
--------------------------------------------------------------------------------

Entity* soc_ball;
Action ball_function(){
my.ENABLE_IMPACT = ON; // event for hit by another moving entity
if(MY.FLOOR_DIST > (MY.MAX_Z - MY.MIN_Z)/2)
{
MY.Z -= MY.FLOOR_DIST - (MY.MAX_Z - MY.MIN_Z)/2;
}
my.z -= 30;
soc_ball = my;
phent_settype(my, PH_RIGID, PH_SPHERE);
phent_setmass(my, 0.2, PH_SPHERE);
phent_setfriction(my, 75);
phent_setelasticity(my, 75, 25);
phent_setdamping(my, 50, 75 );
ph_setgravity( vector(0,0,-386) );
}
in main function
if (key_z==1)
{
temp.x= 15000; temp.y= 0; temp.z= 0;//testing vector
phent_addcentralforce(soc_ball,temp);//give ball power
}

--------------------------------------------------------------------------------

thanks for any advance.
thanks alreaay

Re: [Help] football script that can kick a Long pa [Re: nkl] #62293
01/19/06 12:24
01/19/06 12:24
Joined: Oct 2003
Posts: 1,550
United Kingdom
indiGLOW Offline
Serious User
indiGLOW  Offline
Serious User

Joined: Oct 2003
Posts: 1,550
United Kingdom
I am about to start looking at a very similiar problem and have been asking myself some very similiar questions.

The thing is, we do this everyday in real life and give it hardly any thought, yet the maths behind it are pretty complicated...

Some questions:

Will the pass always reach its target? Presuming it is not intercepted in some way. I presume this is the case, otherwise we are simply talking about lobbing the ball in the appropriate direction.

You may factor in some sort of skill that would modify the trajectory after its calculated, but for now I want the ball to go from passer to passee perfectly, building in power limits and so forth can also come later.

In my case I am looking at throwing, instead of kicking, but the principal's are the same. I have not coded any of this yet, so this is all hypothesis and may well be very wrong and I wouldn't be suprised if there is a simpler solution.

For the ultimate understanding of what your looking for, in terms of the actual maths behind it, I would recommend you read the 'General Ballistic Trajectory' as well as all the other refernces on that page (Certainly a page that should be added to the Physics FAQ), anyway here is the link GSU Department of Physics & Astronomy

The first thing is the angle around the z axis, the one used to work out what direction to send the ball, is something very simple to work out, the only real thing here is to send out some kind of scan from the passer in the direction he is going to pass, to guess who he is trying to pass too, presuming you are not adding some kind of 'off the ball' clone from Fifa, in which case it would know who you are trying to pass to from that. Either way once you know who you are passing to you will need to get the correct angle for the pass, which will of course need to include the 'Lead-Factor' if players are moving. Discussion on calculating the 'Lead-Factor' can be found here Accurate Shooting - Vector Hell

For now lets leave the LF out of the equation and just focus on passing it from one point to the other. Essentially this:


[Some one has just come into the office, I will have to come back to this later today]


The Art of Conversation is dead : Discuss
Re: [Help] football script that can kick a Long pa [Re: indiGLOW] #62294
01/24/06 01:35
01/24/06 01:35
Joined: Sep 2005
Posts: 274
Switzerland - Zurich
zwecklos Offline
Member
zwecklos  Offline
Member

Joined: Sep 2005
Posts: 274
Switzerland - Zurich
heya there,
maybe you want to check out the
"phent_addforcelocal(entity, vecforce, vecpoint);" function, with it, you can decide the amount of the force applied to an entity(vecforce) dependent on the entitys location (vecpoint --> y-achse, x-achse, z-achse, pan, tilt and roll of the entity).

in this way you can let a force applying to an entity to
vecpoint.x = 0, vecpoint.y = 0, vecpoint.z = -50.

now check what kind of shoot/pass were done and change vecforce.z for its purpose

you also can do a banana shot(shot with spin) when you change the values of vecforce.x and vecforce.y while a shot is performing.

hope this helps

cheers

Zwecklos

Last edited by zwecklos; 01/24/06 02:23.

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