SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Thread Tools Display Modes
Old 12/07/2016, 07:40 PM   #231
Join Date: Sep 2013
Location: Flames of Hell
Posts: 3,331
Reputation: 652
Default Re: [alpha] Objects Physics - Handle objects collisions and more.

Originally Posted by VincenzoDrift View Post
Hi, i'm trying to make a basic drop/loot system with ColAndreas and this include. I used Peppe's example to make a function that creates an onbject to throw. If I use the function CreateObject (native) it works perfectly, but if use the streamer of ColAndreas or Incognito's streamer the object spawns, but it doesn't move. I need to use streamer due to objects limit. Any solution?
public DropInventoryItem(playerid, modelid)
	#define SPEED 	(10.0)
	#define Z_SPEED (4.0)
	#define GRAVITY (13.0)
        new Float:posx, Float:posy, Float:posz, Float:posa;		
	GetPlayerPos(playerid, posx, posy, posz);
	GetPlayerFacingAngle(playerid, posa);
	new obj = CA_CreateDynamicObject_DC(modelid, posx, posy - 0.5 * floatcos(-(posa + 90.0), degrees), posz, 93.7, 120.0, posa + 60.0, -1, -1, -1, 300.0, 300.0);
	PHY_UseColAndreas(obj, 1);
	PHY_SetObjectVelocity(obj, SPEED * floatsin(-posa, degrees), SPEED * floatcos(-posa, degrees), Z_SPEED);
	PHY_SetObjectFriction(obj, 100);
	PHY_SetObjectGravity(obj, GRAVITY);
	ApplyAnimation(playerid, "GRENADE", "WEAPON_throwu", 3.0, 0, 0, 0, 0, 0);
	return 1;
You could just use CreateObject for these temporarily. Don't use the CA dynamic objects. Plus, there is a callback in this include for when objects collide with the CA world.

Use CreateObject.
Activate it's physics.
Wait for the world collided callback.
Get the objects information and add the drop.
Add the streamer object.
Destroy the object.
Deactivate it's physics.
Crayder is offline   Reply With Quote
Old 13/07/2016, 12:59 PM   #232
Little Clucker
VincenzoDrift's Avatar
Join Date: Jun 2014
Posts: 47
Reputation: 3
Default Re: [alpha] Objects Physics - Handle objects collisions and more.

Thanks a lot
Sorry for my bad english
VincenzoDrift is offline   Reply With Quote
Old 16/11/2016, 01:15 PM   #233
Join Date: Jun 2016
Posts: 723
Reputation: 8
Default Re: [alpha] Objects Physics - Handle objects collisions and more.

How to make psysic object follow player and will by bouncing? it's for basketball system
MerryDeer is offline   Reply With Quote
Old 19/11/2016, 11:58 PM   #234
GoldenLion's Avatar
Join Date: Sep 2014
Location: Estonia
Posts: 949
Reputation: 141
Default Re: [alpha] Objects Physics - Handle objects collisions and more.

Originally Posted by Billpilot View Post
Looks nice!
Lmao, are you posting in literally every thread saying it's nice just to get post count? For example if you scroll through the gamemodes page you can see that in almost every thread the last post was made by you.
GoldenLion is offline   Reply With Quote
Old 03/11/2017, 02:55 PM   #235
Big Clucker
bboytimix's Avatar
Join Date: Sep 2010
Posts: 97
Reputation: 0
Default Re: [alpha] Objects Physics - Handle objects collisions and more.

just used the weapon's example

pawn Code:
command(launch, playerid, params[])
    #define SPEED (10.0)
    #define Z_SPEED (4.0)
    #define GRAVITY (13.0)
        new modelid = 348; // Deagle Model ID
    new Float:x, Float:y, Float:z, Float:ang;
    GetPlayerPos(playerid, x, y, z);
    GetPlayerFacingAngle(playerid, ang);
    new obj = CreateObject(modelid, x, y - 0.5 * floatcos(-(ang + 90.0), degrees), z, 93.7, 120.0, ang + 60.0);
    PHY_SetObjectVelocity(obj, SPEED * floatsin(-ang, degrees), SPEED * floatcos(-ang, degrees), Z_SPEED);
    PHY_SetObjectFriction(obj, 100); // This will stop the object when it touchs the ground.
    PHY_SetObjectGravity(obj, GRAVITY);
    PHY_SetObjectZBound(obj, z - 1.0, _, 0.0);
    return 1;
the problem is i cant detect the current object pos its not correct
for example when im throwing the weapon ,to grab the weapon i should go to where i throw the object not to the object so i dont have idea to detect the real postion of the thrown object
any ideas ? please +REP
edited also the object not detection the ground when i throw from some roof the object stuck on the air
im Fine
bboytimix is offline   Reply With Quote
Old 04/06/2018, 11:44 PM   #236
Big Clucker
Join Date: Jan 2015
Location: Serbia
Posts: 67
Reputation: 10
Default Re: [alpha] Objects Physics - Handle objects collisions and more.

Im trying to use PHY_UseColAndreas(objectid, mode = 1) but it give me following error
C:\Users\Самп\Desktop\0.3.7\pawno\include\physics. inc(730) : error 017: undefined symbol "PHY_UpdateBounds"
NeamPojma is offline   Reply With Quote
Old 27/05/2019, 04:33 PM   #237
Big Clucker
Join Date: Feb 2018
Posts: 148
Reputation: 3
Default Re: [alpha] Objects Physics - Handle objects collisions and more.

Is ColAndreas NECESSARY?
playstores is offline   Reply With Quote
Old 07/06/2019, 09:37 PM   #238
Big Clucker
Join Date: Jun 2013
Location: Trani, Italy
Posts: 88
Reputation: 190
Default Re: [alpha] Objects Physics - Handle objects collisions and more.

A new update of the library is out v0.5

PHY_RollObject(objectid, toggle = 1, rollingmode = ROLLING_MODE_DEFAULT, ROLLING_MODE_ADVANCED)
More realistic rolling of the objects, through calculations made by using quaternions instead of Euler angles. This can be activated by selecting ROLLING_MODE_ADVANCED in PHY_RollObject.
here's a comparison between the old rolling mode (default) and the new one.

Thanks to gta191977649 for fixing the quaternion calculations and to SimoSbara for merging his code.

UPDATE: changed completely the code for the rolling mode, because it didn't work well; now it does and uses functions taken from i_quat include

demo.pwn, pool.pwn and soccer.pwn have been changed to use the new functionality

Last edited by PeppeAC; 08/06/2019 at 02:10 PM.
PeppeAC is offline   Reply With Quote

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
Player Camera Goes Trough Objects And Attached Objects. [WSF]ThA_Devil Scripting Help 1 20/11/2013 03:40 PM
Handle multiple objects. HeLiOn_PrImE Scripting Help 5 08/04/2012 07:32 AM
If I create the objects in virtual worlds that makes room for other objects? tal_peretz Help Archive 8 17/05/2011 02:48 PM
Question regarding objects, collisions Biesmen Help Archive 5 25/03/2011 07:27 AM
Making objects, deleting created objects KnooL Help Archive 1 15/02/2009 09:34 AM

All times are GMT. The time now is 09:00 AM.

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