InfamousSabre Posted July 11, 2015 Share Posted July 11, 2015 Does anyone know how to get the entity my object has collided with? Link to comment Share on other sites More sharing options...
Pandassaurus Posted July 12, 2015 Share Posted July 12, 2015 I'll tell you in c#, although if you code in c++, I'm sure you can translate it over. Basically what I do is I constantly run a function that uses World.GetNearbyPeds(target, distance); and I add them to a list. Then, I go through every one in that list, and use ped.IsTouching(target); It can work with vehicles, too, if you use World.GetNearbyVehicles(target, distance); Except, if you do it with vehicles, it seems not to work very well with big vehicles. If you want my code, it's open source over here https://www.gta5-mods.com/scripts/portal-gun-net Good Luck! dehan 1 Link to comment Share on other sites More sharing options...
milkjunk87 Posted March 8, 2016 Share Posted March 8, 2016 (edited) have you tried raycastcapsule around entity Position and then DitHitanything and HitEntity parameters? float radius=0.25f;var result = World.RaycastCapsule(position - new Vector3(0,0,radius), position + new Vector3(0,0,radius), radius, IntersectOptions.Map | IntersectOptions.Objects | IntersectOptions.Vegetation, Game.Player.Character); var output = new SphereRaycastResult(); output.HitAnything = result.DitHitAnything; output.HitEntity = result.DitHitEntity; output.WorldCoords = result.HitCoords; output.EntityResult = result.HitEntity; return output; Edited March 8, 2016 by milkjunk87 leftas 1 Link to comment Share on other sites More sharing options...
froggz19 Posted March 8, 2016 Share Posted March 8, 2016 (edited) what about these static BOOL IS_ENTITY_TOUCHING_ENTITY(Entity entity, Entity targetEntity)static BOOL IS_ENTITY_TOUCHING_MODEL(Entity entity, Hash modelHash) Edited March 8, 2016 by froggz19 Link to comment Share on other sites More sharing options...
InfamousSabre Posted March 8, 2016 Author Share Posted March 8, 2016 Necropost, guys. I think I ended up using raycasts. That was a long time ago though. Thanks for the heads-up on the RaycastCapsule or 3dRaycasts though. I wasn't aware of that function. Link to comment Share on other sites More sharing options...
leftas Posted March 14, 2016 Share Posted March 14, 2016 Or you could use **(CEntity + 298) for touching Vehicle **(CEntity + 3A0) for touching Ped **(CEntity + 2A8) for touching Object **(CEntity + 2B8) for touching Entity All the best,Paul. kagikn and InfamousSabre 2 Link to comment Share on other sites More sharing options...
InfamousSabre Posted March 15, 2016 Author Share Posted March 15, 2016 Or you could use **(CEntity + 298) for touching Vehicle **(CEntity + 3A0) for touching Ped **(CEntity + 2A8) for touching Object **(CEntity + 2B8) for touching Entity All the best, Paul. This is exactly what I needed! It will certainly come in handy soon. Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now