Jump to content

Object hits marker


AMARANT

Recommended Posts

Is there any way to check if an object hits a marker? Because the code below doesn't work.

myMarker = createMarker(2228.75,-2240.57,14.29,"cylinder",2.0,255,0,0,125) 
  
addEventHandler( "onMarkerHit",myMarker, 
    function( hitElement,matchingDimension ) 
        if getElementType( hitElement ) == "object" then 
            outputChatBox( "Object hit marker" ) 
        end 
    end 
)    

Link to comment

An object doesn't move like a vehicle does, it only changes position (first it is at position A and then on position B, while a vehicle moves from A to B). That's why it doesn't work and never will work. The only way to make it work is using a colshape OR adding a colshape and checking all elements in the colshape repeatedly at a high rate, using a timer or (clientside) using render, so you can't miss it if an element suddenly entered the marker.

https://wiki.multitheftauto.com/wiki/Get ... inColShape

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...