open.mp forum
[Plugin] ColAndreas - Collision Detection and Raytracing - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Releases (https://forum.open.mp/forumdisplay.php?fid=13)
---- Forum: Plugins (https://forum.open.mp/forumdisplay.php?fid=32)
---- Thread: [Plugin] ColAndreas - Collision Detection and Raytracing (/showthread.php?tid=175)



ColAndreas - Collision Detection and Raytracing - Crayder - 2019-04-14

[Image: in7FgoQ.gif]

____________________________________________________________________________________________________



Developers:



Initial Developers:

[uL]Slice

[uL]Chris420

[uL]Pottus

Latest Developers:

uint32 (new developer ?) (Where'd ya go?) - This guy fixed some major shit, including the initial SA-MP object thing.

Crayder

Codectile

____________________________________________________________________________________________________



Download today!

____________________________________________________________________________________________________



Installation Instructions:

  1. Navigate to the github repository's release section (link above) and download the latest version.

  2. If you don't need the source just download the wizard, the plugin, and include.

  3. Run the binary builder application. This will generate a binary in which ColAndreas load data from.

  4. Create a folder in your scriptfiles called "colandreas" and place the binary file there.

  5. Add ColAndreas to your server.cfg.

____________________________________________________________________________________________________



Current Functions:

Code:
CA_ContactTest(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz)

CA_CreateDynamicObject_DC(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, vw = -1, interior = -1, playerid = -1, Float:streamdist = 300.0, Float:drawdist = 300.0)

CA_CreateDynamicObject_SC(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, vw = -1, interior = -1, playerid = -1, Float:streamdist = 300.0, Float:drawdist = 300.0)

CA_CreateDynamicObjectEx_DC(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, Float:drawdistance = 0.0, Float:streamdistance = 200.0, worlds[] = { -1 }, interiors[] = { -1 }, players[] = { -1 }, maxworlds = sizeof worlds, maxinteriors = sizeof interiors, maxplayers = sizeof players)

CA_CreateDynamicObjectEx_SC(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, Float:drawdistance = 0.0, Float:streamdistance = 200.0, worlds[] = { -1 }, interiors[] = { -1 }, players[] = { -1 }, maxworlds = sizeof worlds, maxinteriors = sizeof interiors, maxplayers = sizeof players)

CA_CreateObject(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, bool:add = false)

CA_CreateObject_DC(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, Float:drawdistance = 300.0)

CA_CreateObject_SC(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, Float:drawdistance = 300.0)

CA_DestroyAllObjects_DC()

CA_DestroyObject(index)

CA_DestroyObject_DC(index)

CA_EulerToQuat(Float:rx, Float:ry, Float:rz, &Float:x, &Float:y, &Float:z, &Float:w)

CA_FindZ_For2DCoord(Float:x, Float:y, &Float:z)

CA_GetModelBoundingBox(modelid, &Float:minx, &Float:miny, &Float:minz, &Float:maxx, &Float:maxy, &Float:maxz)

CA_GetModelBoundingSphere(modelid, &Float:offx, &Float:offy, &Float:offz, &Float:radius)

CA_GetObjectExtraID(index, type)

CA_Init()

CA_IsPlayerBlocked(playerid, Float:dist=1.5, Float:height=0.5)

CA_IsPlayerInWater(playerid, &Float:depth, &Float:playerdepth)

CA_IsPlayerNearWater(playerid, Float:dist=3.0, Float:height=3.0)

CA_IsPlayerOnSurface(playerid, Float:tolerance=1.5)

CA_QuatToEuler(Float:x, Float:y, Float:z, Float:w, &Float:rx, &Float:ry, &Float:rz)

CA_RayCastLine(Float:StartX, Float:StartY, Float:StartZ, Float:EndX, Float:EndY, Float:EndZ, &Float:x, &Float:y, &Float:z)

CA_RayCastLineAngle(Float:StartX, Float:StartY, Float:StartZ, Float:EndX, Float:EndY, Float:EndZ, &Float:x, &Float:y, &Float:z, &Float:rx, &Float:ry, &Float:rz)

CA_RayCastLineAngleEx(Float:StartX, Float:StartY, Float:StartZ, Float:EndX, Float:EndY, Float:EndZ, &Float:x, &Float:y, &Float:z, &Float:rx, &Float:ry, &Float:rz, &Float:ocx, &Float:ocy, &Float:ocz, &Float:orx, &Float:ory, &Float:orz)

CA_RayCastLineExtraID(type, Float:StartX, Float:StartY, Float:StartZ, Float:EndX, Float:EndY, Float:EndZ, &Float:x, &Float:y, &Float:z)

CA_RayCastLineEx(Float:StartX, Float:StartY, Float:StartZ, Float:EndX, Float:EndY, Float:EndZ, &Float:x, &Float:y, &Float:z, &Float:rx, &Float:ry, &Float:rz, &Float:rw, &Float:cx, &Float:cy, &Float:cz)

CA_RayCastLineID(Float:StartX, Float:StartY, Float:StartZ, Float:EndX, Float:EndY, Float:EndZ, &Float:x, &Float:y, &Float:z)

CA_RayCastLineNormal(Float:startx, Float:starty, Float:startz, Float:endx, Float:endy, Float:endz, &Float:x, &Float:y, &Float:z, &Float:nx, &Float:ny, &Float:nz)

CA_RayCastMultiLine(Float:StartX, Float:StartY, Float:StartZ, Float:EndX, Float:EndY, Float:EndZ, Float:retx[], Float:rety[], Float:retz[], Float:retdist[], ModelIDs[], size = sizeof(retx))

CA_RayCastReflectionVector(Float:startx, Float:starty, Float:startz, Float:endx, Float:endy, Float:endz, &Float:x, &Float:y, &Float:z, &Float:nx, &Float:ny, &Float:nz)

CA_RemoveBarriers()

CA_RemoveBreakableBuildings()

CA_RemoveBuilding(modelid, Float:x, Float:y, Float:z, Float:radius)

CA_SetObjectExtraID(index, type, data)

CA_SetObjectPos(index, Float:x, Float:y, Float:z)

CA_SetObjectPos_DC(index, Float:x, Float:y, Float:z)

CA_SetObjectRot(index, Float:rx, Float:ry, Float:rz)

CA_SetObjectRot_DC(index, Float:rx, Float:ry, Float:rz)

Float:CA_GetRoomHeight(Float:x, Float:y, Float:z)

____________________________________________________________________________________________________



Loading ColAndreas:



We recommend using a filterscript to help organize your objects. There is a specific order of operations required to load successfully.



Code:
public OnFilterScriptInit()

{

// Add any remove buildings (This only works once)

CA_RemoveBuilding();



// Initialize the collision world (This creates San Andreas, the entire map, excluding removed buildings)

CA_Init();



// Create objects

CA_CreateDynamicObject_SC();



return 1;

}

____________________________________________________________________________________________________



Capability Demo:

[Video: http://www.youtube.com/watch?v=aSabQWqQBkI]

____________________________________________________________________________________________________



Known Issues:
  • There is no virtual world / interior support (there may never be).




RE: ColAndreas - Collision Detection and Raytracing - Crayder - 2019-04-14

https://github.com/Pottus/ColAndreas/wiki



The wiki has been updated. Installation and usage should be much easier now! Let me know if you have any further questions, inquiries, or issues.


RE: ColAndreas - Collision Detection and Raytracing - Mugsy - 2019-04-14

good thread


RE: ColAndreas - Collision Detection and Raytracing - adri1 - 2019-08-03

does this works with 0.3.DL custom objects?


RE: ColAndreas - Collision Detection and Raytracing - Crayder - 2019-09-27

(2019-08-03, 03:59 PM)adri1 Wrote: does this works with 0.3.DL custom objects?



It does now, thanks to?iAmir


RE: ColAndreas - Collision Detection and Raytracing - Josh - 2019-09-27

(2019-09-27, 08:17 PM)Crayder Wrote:
(2019-08-03, 03:59 PM)adri1 Wrote: does this works with 0.3.DL custom objects?



It does now, thanks to?iAmir



thank me too


RE: ColAndreas - Collision Detection and Raytracing - Jackins - 2019-11-27

Not working on Debian9


RE: ColAndreas - Collision Detection and Raytracing - JustMe.77 - 2021-01-03

I'm having these Errors if I try to compile my gamemode:





../Modules/Server/tpgun.pwn(108) : warning 202: number of arguments does not match definition

../Modules/Server/tpgun.pwn(108) : warning 202: number of arguments does not match definition

../Modules/Server/tpgun.pwn(108) : warning 202: number of arguments does not match definition

../Modules/Server/tpgun.pwn(108) : warning 202: number of arguments does not match definition

../Modules/Server/tpgun.pwn(108) : warning 202: number of arguments does not match definition

../Modules/Server/tpgun.pwn(114) : error 017: undefined symbol "CA_CreateDynamicObjectEx_SC"





Code:
public OnGameModeInit()

{

? // Objects need to be removed BEFORE calling CA_Init

CA_RemoveBuilding(); //Line 108



? // Load the SA map

CA_Init();



// Create objects and add them to the simulation

CA_CreateDynamicObjectEx_SC();



#if defined tpgun_OnGameModeInit

? ? return tpgun_OnGameModeInit();

? ? #else

? ? return 1;

? ? #endif

}



RE: ColAndreas - Collision Detection and Raytracing - DanMas - 2021-01-06

it will be very useful, if you add function like CA_IsPlayerInWater, who shows depth and playerdepth to the water, but for the ground. Or i can do it somehow in my own scripts?



(2021-01-03, 03:55 PM)JustMe.77 Wrote: ..

and you need to look arguments in colandreas.inc for functions. CA_RemoveBuilding like same RemoveBuildingForPlayer, but without playerid, and CA_CreateDynamicObjectEx_SC, its CreateDynamicObjectEx extension from streamer plugin, who also adds collision as i know ( read more wiki ). You can keep only CA_Init(); and map will be loaded if you have colandreas.cadb