Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New events - onElementAttach/onElementDetach #3273

Open
1 task done
Allerek opened this issue Dec 17, 2023 · 9 comments · May be fixed by #3353
Open
1 task done

New events - onElementAttach/onElementDetach #3273

Allerek opened this issue Dec 17, 2023 · 9 comments · May be fixed by #3353
Labels
enhancement New feature or request

Comments

@Allerek
Copy link
Contributor

Allerek commented Dec 17, 2023

Is your feature request related to a problem? Please describe.

Currently we have no event to tell if element has ben attached/detached to any other element

Describe the solution you'd like

Two events

onElementAttach \ onElementDetach

Params:
element to which source has been attached
Vector 3 with global position of element after attaching
Vector3 with offset of attachment
Vector3 with rotation offset of attachment

(we may want vectors with detach as some people might want to keep rotation and position of element after for example deatching)

Describe alternatives you've considered

No response

Additional context

No response

Security Policy

  • I have read and understood the Security Policy and this issue is not about a cheat or security vulnerability.
@Allerek Allerek added the enhancement New feature or request label Dec 17, 2023
@Fernando-A-Rocha
Copy link
Contributor

Also add onClientElementAttach and onClientElementDetach right?

@Allerek
Copy link
Contributor Author

Allerek commented Dec 18, 2023

Also add onClientElementAttach and onClientElementDetach right?

Yeah, sure, its pretty straightforward

@Nico8340 Nico8340 linked a pull request Mar 30, 2024 that will close this issue
@Nico8340
Copy link
Contributor

I wanted to extend my sincere thanks for your idea shared on GitHub! With your inspiration, I've created a pull request that implements the concept you've proposed. I hope you'll continue to share your ideas and feedback for future developments.

Thank you, and I look forward to hearing more of your ideas!
#3353

Best regards,
Nico

@TheNormalnij
Copy link
Contributor

What is the purpose of those events? Could you give an example of how to use it?

@Allerek
Copy link
Contributor Author

Allerek commented Apr 2, 2024

What is the purpose of those events? Could you give an example of how to use it?

You have a box attached to sadler. You want to detach it and drop it right behind the vehicle, keeping its rotation - you can do so using this.

@Nico8340
Copy link
Contributor

Nico8340 commented Apr 2, 2024

You have a box attached to sadler. You want to detach it and drop it right behind the vehicle, keeping its rotation - you can do so using this.

By the way, I also fixed the rotation bug in this PR, now the rotation remains even after detach.

@TheNormalnij
Copy link
Contributor

You have a box attached to sadler. You want to detach it and drop it right behind the vehicle, keeping its rotation - you can do so using this.

It doesn't look like a valid usage example. In this case, you should call a function that does deattach and handles next object position. There is no reason for spaghetti code.

@Allerek
Copy link
Contributor Author

Allerek commented Apr 3, 2024

You have a box attached to sadler. You want to detach it and drop it right behind the vehicle, keeping its rotation - you can do so using this.

It doesn't look like a valid usage example. In this case, you should call a function that does deattach and handles next object position. There is no reason for spaghetti code.

This would work only if you write the code yourself, and not use open-source resources from the web. This allows integration between resources coming from different developers without using exports.

@Nico8340
Copy link
Contributor

Nico8340 commented Apr 3, 2024

Recently, someone uploaded a resource, which can be used to improve the prelight of attached objects using a shader, for example these event would be very useful for that, so you don't need to export it from a util resource, just use the new built-in events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants