s2sk

Collision not attach to object?

Recommended Posts

Hello. Sry for my english.

I creating object:

local element_object = createObject(13025, 123.123, 123.123, 123.123, 123.123, 123.123, 123.123)

 

I creating collision:

local element_col = createColCircle(0.0, 0.0, 25.0)

 

I attach collision to object

attachElements(element_col, element_object)

 

And when i hit collision onElementColShapeHit not call. wtf? what i doing wrong?

But i attach object to collision then everything works. 

attachElements(element_object, element_col) -- change variables

 

Share this post


Link to post

lol. In debug mode collision attach on object. Why not call onElementColShapeHit?

20 minutes ago, NeXuS™ said:

I dont know if you can attach colshapes at all. Try to use setDevelopmentMode and showcol.

function onCollision(colShapeHit)

    outputChatBox("COLLISION")
end
addEventHandler("onElementColShapeHit", getRootElement(), onCollision)

 

Share this post


Link to post

Are you using this on server-side?

Share this post


Link to post
1 minute ago, NeXuS™ said:

Are you using this on server-side?

Yes

Share this post


Link to post
1 minute ago, NeXuS™ said:

After my testings, it seems like MTA still cant use colshape events after the colshape is attached. Just don't use attachElements and use setElementPosition instead.

But, in vehicle attach - work. If i use offset in attachElemnts and me lazy to consider the rotation angle?

Share this post


Link to post

At vehicles, it works. But on objects, it is totally useless.

YEuFb7e.jpg

It says I just entered a colshape which is about 40 units away.

Edited by NeXuS™
  • Thanks 1

Share this post


Link to post
4 minutes ago, NeXuS™ said:

At vehicles, it works. But on objects, it is totally useless.

YEuFb7e

It says I just entered a colshape which is about 40 units away.

when the streamer you can attach.... more API in the MTA they said....

Share this post


Link to post

And it seems like upon reconnecting, the collisions position is fixed, and it is at the position it should be, with the event working just fine.

Share this post


Link to post
3 minutes ago, NeXuS™ said:

And it seems like upon reconnecting, the collisions position is fixed, and it is at the position it should be, with the event working just fine.

nice bug. admins fix pls in 1.5.6 :)

Share this post


Link to post

An object isn't a streamed able element. There is no way for server-side to know where this colshape is located in the world. (Especially when the client moves the object)

It might be possible based on last set position but even so it is very inaccurate.

 

Share this post


Link to post

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.