SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 20/05/2020, 05:38 AM   #1
TracerX
Big Clucker
 
TracerX's Avatar
 
Join Date: Jun 2014
Location: Poland
Posts: 54
Reputation: 2
Default object-physics include

Hey,
I was recently trying to work with the Physics include by Peppe, I wanted to create a ball which would be affected by any kind of collision, either it's a vehicle or a player.

Like: Player touches the ball, it would move
Vehicle touches the ball, it would move, is that even possible?

Anyway, thing is, the starters didn't even work out for me. I was testing the include before doing anything and I couldn't get the object to move? when I issue the command, the object gets created and it moves for like 2m then it doesn't move at all again, it wouldn't collide with my player nor a vehicle. What should I do?

My code:

PHP Code:
YCMD:phytest(playeridparams[], help)
{
    
#define SPEED (10.0)
    #define Z_SPEED (4.0)
    #define GRAVITY (13.0)
    
new Float:ppXFloat:ppYFloat:ppZFloat:ppA;
    
GetPlayerPos(playeridppXppYppZ);
    
GetPlayerFacingAngle(playeridppA);
    
RL_BALL CreateObject(2114ppXppYppZ000100.0);
    
SetObjectMaterial(RL_BALL05033"union_las""ws_carparkwall2"0);
    
PHY_InitObject(RL_BALL);
    
PHY_RollObject(RL_BALL_PHY_ROLLING_MODE_ADVANCED);
    
PHY_SetObjectFriction(RL_BALL7.0);
    
PHY_SetObjectVelocity(RL_BALLSPEED floatsin(-ppAdegrees), SPEED floatcos(-ppAdegrees), Z_SPEED);
    
PHY_SetObjectAirResistance(RL_BALL0.2);
    
PHY_SetObjectGravity(RL_BALL10.0);
    
PHY_SetObjectZBound(RL_BALL__0.5);
    
PHY_ToggleObjectPlayerColls(RL_BALL10.6);
    
PlayerData[playerid][inPhysics] = true;
    
PHY_CreateArea(ppX-70.0ppY-70.0ppX+70.0ppY+70.0__424.5);
    return 
1;

__________________
TracerX is offline   Reply With Quote
Old 20/05/2020, 10:14 AM   #2
PeppeAC
Big Clucker
 
Join Date: Jun 2013
Location: Trani, Italy
Posts: 89
Reputation: 192
Default Re: object-physics include

https://pastebin.com/zGBs8rwt

Try looking at the soccer gamemode to see how to make interact player and ball

At the moment, it is not straightforward to make vehicle and objects interact, as you would need vehicle collision data and dedicated collision physics
PeppeAC is offline   Reply With Quote
Old 20/05/2020, 10:39 AM   #3
YouShootIDodge
Big Clucker
 
Join Date: May 2019
Posts: 65
Reputation: 14
Default Re: object-physics include

You need ColAndreas plugin, make sure you initiate the plugin correctly under OnGameModeInit and have the required binary file for it in the scriptfiles folder.
YouShootIDodge is online now   Reply With Quote
Old 20/05/2020, 11:38 AM   #4
TracerX
Big Clucker
 
TracerX's Avatar
 
Join Date: Jun 2014
Location: Poland
Posts: 54
Reputation: 2
Default Re: object-physics include

I have ColAndreas plugin. @Peppe, can you please show me an example of how to make a vehicle interact with an object? I also don't seem to find my problem looking at the soccer gamemode.. @The soccer gamemode, you make the player react with the ball using Keys I assume, I wanted to make the ball automatically react with the vehicle, how am I supposed to that? Or even with the player?
__________________
TracerX is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Physics.inc problem NeamPojma Scripting Help 1 05/06/2018 09:36 AM
Which physics plugin is the best? iWhite Scripting Help 2 07/12/2015 09:47 AM
What is wrong with physics.ini? Metharon Scripting Help 6 10/06/2015 02:40 PM
Physics.inc deimantas1 Scripting Help 2 24/09/2013 03:44 PM


All times are GMT. The time now is 08:57 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.