02.11.2015, 20:22
Say for instance a player touches or punches an object, is it detectable?
|
Yes it is detectable, now. Have a look at this cimulator-collision detection and physics simulation.
Need a script for demo? check out line number, 60 and 260 |
|
With that example you would actually be better only updating the capsule position when you actually need to make a check right ?
|
stock IsPlayerInContact(playerid)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
/*
*0.3 is the radius and 0.9 is the height and I think that,
*the second parameter is of no use so I'll remove it in the next update
*/
CR_CreateCapsuleCharacter(playerid, 1, x, y, z, 0.3, 0.9); //you can define your own radius and height
new check = CR_CharacterContactTest(playerid); //I'll try to add this today, most probably
CR_DeleteCharacter(playerid);
return check; //returns 1 if collision is detected else returns 0
}
|
Yes it can be detected, but not in SA-MP natively.
codectile's plugin would not detect an actual punch on the object, just if the player's surrounding capsule would contact the object. You could also use a ColAndreas ray cast for it, but still that is not detecting it either. The best solution would be a client side plugin, which obviously isn't ideal. |