[Include] [alpha] Objects Physics - Handle objects collisions and more.
#72

Quote:
Originally Posted by VincenzoDrift
Посмотреть сообщение
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);
		
	Streamer_Update(playerid);
	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_InitObject();
	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.
Reply


Messages In This Thread
Objects Physics - Handle objects 3D/2D physics (collisions, gravity, ...) - by PeppeAC - 25.06.2013, 12:14
Re: [alpha] Objects Physics - Handle objects collisions and more. - by TheArcher - 25.06.2013, 12:28
Re: [alpha] Objects Physics - Handle objects collisions and more. - by IstuntmanI - 25.06.2013, 14:11
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Dan.. - 25.06.2013, 14:25
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Littlehelper - 25.06.2013, 14:27
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Black Wolf - 25.06.2013, 14:29
Re: [alpha] Objects Physics - Handle objects collisions and more. - by PeppeAC - 25.06.2013, 14:35
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Lordzy - 25.06.2013, 14:39
Re: [alpha] Objects Physics - Handle objects collisions and more. - by KingHual - 25.06.2013, 14:39
Re: [alpha] Objects Physics - Handle objects collisions and more. - by IPrototypeI - 25.06.2013, 14:45
Re: [alpha] Objects Physics - Handle objects collisions and more. - by kristo - 25.06.2013, 14:54
Respuesta: [alpha] Objects Physics - Handle objects collisions and more. - by [DOG]irinel1996 - 25.06.2013, 15:18
Re: [alpha] Objects Physics - Handle objects collisions and more. - by vyper - 25.06.2013, 15:33
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Stylock - 25.06.2013, 18:16
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Johnson_boy - 25.06.2013, 20:35
Re: [alpha] Objects Physics - Handle objects collisions and more. - by n0minal - 25.06.2013, 20:41
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Kar - 26.06.2013, 00:40
Re: [alpha] Objects Physics - Handle objects collisions and more. - by QuaTTrO - 26.06.2013, 07:33
Re: [alpha] Objects Physics - Handle objects collisions and more. - by PeppeAC - 26.06.2013, 11:43
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Black Wolf - 26.06.2013, 12:14
Re: [alpha] Objects Physics - Handle objects collisions and more. - by davve95 - 26.06.2013, 12:36
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Flyfishes - 26.06.2013, 12:36
Re: [alpha] Objects Physics - Handle objects collisions and more. - by PeppeAC - 26.06.2013, 13:12
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Memoryz - 26.06.2013, 14:10
Re: [alpha] Objects Physics - Handle objects collisions and more. - by PeppeAC - 26.06.2013, 14:17
Re: [alpha] Objects Physics - Handle objects collisions and more. - by PeppeAC - 26.06.2013, 14:49
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Maran3llo - 26.06.2013, 15:17
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Excel™ - 26.06.2013, 15:47
Re: [alpha] Objects Physics - Handle objects collisions and more. - by PeppeAC - 27.06.2013, 11:02
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Niko_boy - 27.06.2013, 11:12
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Manolito - 20.10.2013, 03:56
Re: [alpha] Objects Physics - Handle objects collisions and more. - by leong124 - 29.10.2013, 11:32
Re: [alpha] Objects Physics - Handle objects collisions and more. - by TheArcher - 29.10.2013, 19:59
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Pottus - 29.10.2013, 22:04
Re: [alpha] Objects Physics - Handle objects collisions and more. - by ikey07 - 29.10.2013, 22:53
Re: [alpha] Objects Physics - Handle objects collisions and more. - by leong124 - 30.10.2013, 01:53
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Pottus - 30.10.2013, 01:56
Respuesta: [alpha] Objects Physics - Handle objects collisions and more. - by Malganys - 15.11.2013, 21:41
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Captive - 21.11.2013, 11:06
Re: [alpha] Objects Physics - Handle objects collisions and more. - by newbie scripter - 13.01.2014, 06:37
Respuesta: [alpha] Objects Physics - Handle objects collisions and more. - by Malganys - 06.02.2014, 21:59
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Banditukas - 23.12.2014, 11:08
Re: [alpha] Objects Physics - Handle objects collisions and more. - by $$inSane - 24.12.2014, 04:50
Re: [alpha] Objects Physics - Handle objects collisions and more. - by newbie scripter - 01.02.2015, 13:20
Re: [alpha] Objects Physics - Handle objects collisions and more. - by newbie scripter - 04.02.2015, 15:50
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Crayder - 04.02.2015, 21:24
Re: [alpha] Objects Physics - Handle objects collisions and more. - by newbie scripter - 30.03.2015, 09:51
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Crayder - 30.03.2015, 11:38
Re: [alpha] Objects Physics - Handle objects collisions and more. - by newbie scripter - 31.03.2015, 02:53
Re: [alpha] Objects Physics - Handle objects collisions and more. - by newbie scripter - 02.04.2015, 10:34
Re: [alpha] Objects Physics - Handle objects collisions and more. - by PeppeAC - 02.04.2015, 13:19
Re: [alpha] Objects Physics - Handle objects collisions and more. - by PeppeAC - 06.07.2015, 22:03
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Battlezone - 12.08.2015, 14:16
Respuesta: [alpha] Objects Physics - Handle objects collisions and more. - by Malganys - 13.08.2015, 21:09
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Stanford - 22.12.2015, 15:20
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Pottus - 22.12.2015, 18:45
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Stanford - 23.12.2015, 16:48
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Stanford - 24.12.2015, 08:30
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Stanford - 19.01.2016, 11:08
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Crayder - 19.01.2016, 16:17
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Stanford - 19.01.2016, 19:23
Re: [alpha] Objects Physics - Handle objects collisions and more. - by PeppeAC - 09.02.2016, 13:21
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Speiki2208 - 24.02.2016, 14:20
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Max_Andolini - 11.05.2016, 14:43
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Crayder - 11.05.2016, 15:55
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Max_Andolini - 11.05.2016, 16:14
Re: [alpha] Objects Physics - Handle objects collisions and more. - by ScIrUsna - 14.06.2016, 15:26
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Max_Andolini - 16.06.2016, 02:33
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Greggu - 16.06.2016, 14:49
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Crayder - 17.06.2016, 06:16
Re: [alpha] Objects Physics - Handle objects collisions and more. - by VincenzoDrift - 12.07.2016, 14:42
Re: [alpha] Objects Physics - Handle objects collisions and more. - by Crayder - 12.07.2016, 18:40
Re: [alpha] Objects Physics - Handle objects collisions and more. - by VincenzoDrift - 13.07.2016, 11:59
Re: [alpha] Objects Physics - Handle objects collisions and more. - by MerryDeer - 16.11.2016, 12:15
Re: [alpha] Objects Physics - Handle objects collisions and more. - by GoldenLion - 19.11.2016, 22:58
Re: [alpha] Objects Physics - Handle objects collisions and more. - by NeamPojma - 04.06.2018, 22:44
Re: [alpha] Objects Physics - Handle objects collisions and more. - by IZenta - 02.07.2020, 11:33

Forum Jump:


Users browsing this thread: 8 Guest(s)