Jump to content
draoth

Check Object Collision (No solution yet)

Recommended Posts

Hello everyone.

 

I'm creating a spawner that spawns around 300 different items in the 400 m2  range.

How can i make my script detect if two objects spawn in each other?

 

This is my script:

_Locationx = floor random [-85,0,85];
_Locationy = floor random [-85,0,85];
_AllStr = Selectrandom ["Land_Wreck_Hunter_F","Land_Cncbarriermedium_F","Land_HBarrierBower_F","Land_toiletbox_F","land_bagbunker_small_f","land_ancientpillar_damaged_f","land_ancientpillar_fallen_f","land_ancientpillar_f","land_cinderblocks_f","land_pallet_vertical_f","land_bricks_v2_f","land_bricks_v1_f","land_bricks_v3_f","land_timbers_f","land_bagwall_long_f"];
_randomD = floor(random 360);
_Str = createVehicle [_AllStr, getMarkerPos "area1", [], 0, ""];
_Str enablesimulation false;
_Str allowdamage false;
_locationstrX = (getPos _Str select 0);
_locationstrY = (getPos _Str select 1);
_Str setPos [_locationstrx + _Locationx ,_locationstry + _Locationy,9.293];
_Str setDir _randomD;
[_Str] execVM "Hitcheck.sqf";

I hope someone has a solution to my problem.

 

Draoth

 

 

Share this post


Link to post
Share on other sites

epeContactStart event handler?

You could always check the distance between any given two. 

  • Like 1

Share this post


Link to post
Share on other sites
7 minutes ago, Midnighters said:

epeContactStart event handler?

You could always check the distance between any given two. 

Thanks for your fast response.

Isn't epeContactStart only for objects with physics? 

 

Quote

Triggered when object collision (PhysX) starts. 

And how can i check the distance between all 300 objects spawned with the same name? : _Str

Perhaps with nearObjects. I will check that first. 

 

If you or someone else has a better solution, I would like to hear it ;).

 

 

Share this post


Link to post
Share on other sites
40 minutes ago, draoth said:

Thanks for your fast response.

Isn't epeContactStart only for objects with physics? 

 

And how can i check the distance between all 300 objects spawned with the same name? : _Str

Perhaps with nearObjects. I will check that first. 

 

If you or someone else has a better solution, I would like to hear it ;).

 

 

The epe contact event hanlder is for physical collision no matter if stored in a weapon holder (i believe). AttachTo will be the only thing that prevents it from firing unless you collide with the ground the returned object will. 

 

Dont know how well checking the distance between each will work. Very taxing on performance i would believe. The epe event handlers should work fairly well. 

Share this post


Link to post
Share on other sites
59 minutes ago, Midnighters said:

The epe contact event hanlder is for physical collision no matter if stored in a weapon holder (i believe). AttachTo will be the only thing that prevents it from firing unless you collide with the ground the returned object will. 

 

Dont know how well checking the distance between each will work. Very taxing on performance i would believe. The epe event handlers should work fairly well. 

 

I tried the EpeContact event handler but it didn't seem to work. 

i added this to my script:

_Str addeventhandler ["EpeContactStart",{deletevehicle _Str}];

I don't have that much experience with eventhandlers so i'm probally doing something wrong.

I also tried disabling the : 

_Str enablesimulation false;

But that didn't work either.

If you know what's wrong please explain it to me. So i can use eventhandlers in my future scripts.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×