Phy.inc -
Ph0eniX - 26.09.2018
Hi all , i have an problem with physics.inc (i never used it before so...idk sure what's wrong
)
So , my problem it's ... the object won't move.
Код HTML:
CMD:testmove(playerid,params[])
{
new Float:spd;
if(sscanf(params,"f",spd))
return SendClientMessage(playerid,-1,"Usage: /testmove [Speed]");
PHY_SetObjectVelocity(Biliard[AccInfo[playerid][InPool]][Ball][0], 0.0, -speed);
return 1;
}
Код HTML:
stock InitBall(PoolID,i)
{
PHY_InitObject(Biliard[PoolID][Ball][i], 3003, _, _, Ex_MODE_2D);
PHY_SetObjectFriction(Biliard[PoolID][Ball][i], 0.40);
PHY_RollObject(Biliard[PoolID][Ball][i]);
PHY_SetObjectWorld(Biliard[PoolID][Ball][i], 3);
Biliard[PoolID][bExist][i] = 1;
}
Biliard[PoolID][Ball][0] = CreateObject(3003, 0.010589+Biliard[PoolID][x], 0.428184+Biliard[PoolID][y], 0.930358+Biliard[PoolID][z], 0, 0, 0);
What i should do?
EDIT: And at stock InitBall i get akslimit.
Re: Phy.inc -
CodeStyle175 - 26.09.2018
this thing doesnt make sense
Re: Phy.inc -
Lokii - 26.09.2018
https://github.com/uPeppe/Object-Phy...de/physics.inc
Re: Phy.inc -
Gammix - 26.09.2018
You could also achieve similar results using an updated and simpler version of Physics include:
https://sampforum.blast.hk/showthread.php?tid=630602
PHP код:
#define MAX_BALLS 5
enum E_BALL_DATA {
BALL_OBJECT,
BALL_PROJECTILE
};
new balls[MAX_BALLS][E_BALL_DATA];
public OnGameModeInit() {
for (new i = 0; i < MAX_BALLS; i++) {
balls[i][BALL_OBJECT] = CreateDynamicObject(..); // create your ball objects here
}
return 1;
}
CMD:testmove(playerid,params[]) {
new ballid, Float:spd;
if(sscanf(params,"if",spd))
return SendClientMessage(playerid,-1,"Usage: /testmove [Ballid] [Speed]");
new Float:x, Float:y, Float:z;
GetDynamicObjectPos(balls[ballid][BALL_OBJECT], x, y, z);
// "aim_angle" will be the angle player is aiming the ball to go in direction
// since we are dealing with 2D physics, set "vz" to 0.0
balls[ballid][BALL_PROJECTILE] = Projectile(x, y, z, speed * floatsin(-aim_angle, degrees), speed * floatcos(-aim_angle, degrees), 0.0, .ground_friction = 0.40);
return 1;
}
public OnProjectileUpdate(projid) {
new Float:x, Float:y, Float:z;
for (new i = 0; i < MAX_BALLS; i++) {
if (projid == balls[i][BALL_PROJECTILE]) {
// update the object position when projectile updates
GetProjectilePos(projid, x, y, z);
SetDynamicObjectPos(balls[i][BALL_OBJECT], x, y, z);
// update rotation
GetProjectileRot(projid, x, y, z);
SetDynamicObjectRot(balls[i][BALL_OBJECT], x, y, z);
}
}
}
public OnProjectileCollide(projid, type, Float:x, Float:y, Float:z, extraid) {
for (new i = 0; i < MAX_BALLS; i++) {
if (projid == balls[i][BALL_PROJECTILE]) {
if (type == 3) { // ball collided with an object
// do your stuff here !
}
}
}
}
Re: Phy.inc -
Ph0eniX - 27.09.2018
Thanks , but i want to resolve my script bcz it's almost done. But i have only this problem
.
I really don't know why it's making this to me. It can be bcz i have this enum like that?
Код HTML:
enum benum
{
...
Ball[16],
...
}
new Biliard[MAX_POOL][benum];
Re: Phy.inc -
CodeStyle175 - 27.09.2018
projectile doesn't have object rotation.