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

Get name of obj that touched the rigidbody using .Touched #51

Open
NuggetXX2000 opened this issue Dec 7, 2023 · 2 comments
Open

Get name of obj that touched the rigidbody using .Touched #51

NuggetXX2000 opened this issue Dec 7, 2023 · 2 comments
Assignees
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@NuggetXX2000
Copy link

Description

What do you need help with/what is your query? Describe in 30-40 words or more!

When using .Touched, I am unable to get the name of the obj that has touched the rigidbody

example:
sprite.Touched:Connect(function(id)
objTouched = engine:GetBodyById(id)
print(tostring( objTouched.Name )) -- Returns nil, I've tried many other ways but it returns a table value or just the id
end)

So far I have

What have you tried so far? (Optional)

Searched online, searched nature2d forum

Lastly

Anything else you would like to share?

If this is an easy fix I'll feel stupid

@NuggetXX2000 NuggetXX2000 added help wanted Extra attention is needed question Further information is requested labels Dec 7, 2023
@Rulyns
Copy link

Rulyns commented Aug 4, 2024

Hey, I dont know if you still need this info. But After you initiate the object, you can add additional properties such as Name. Here's my example:
melon.Name = "mel" print(engine:GetBodyById(melon.id).Name)

You would call this AFTER you create an object through Engine:Create(), this is NOT something you type when you're creating the object, just right after

@NuggetXX2000
Copy link
Author

NuggetXX2000 commented Aug 5, 2024

Hey, I dont know if you still need this info. But After you initiate the object, you can add additional properties such as Name. Here's my example: melon.Name = "mel" print(engine:GetBodyById(melon.id).Name)

You would call this AFTER you create an object through Engine:Create(), this is NOT something you type when you're creating the object, just right after

Thanks! I have since put off the project but whenever I get the chance to, I will use this and let you know. Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants