A Few Questions about Colliders.lua

Description: Archive discussion
============================
Original description:
Official subforum for LunaLua - an extension framework for SMBX Engine Version 1.3 (which a core of SMBX 2.0). Share your creations that require the use of LunaLUA. You may also share info/tutorials on how to use LunaLUA.

Sambo M
Topic author, Count
Count
Avatar
Sambo M
Topic author, Count
Count
Age: 25
Reputation: 15
Posts: 264
Joined: 27 Jun 2014

Post #1by Sambo » 25 Oct 2015, 0:24

I have a few questions about the Colliders library:
1) Is there a quick way to tell which side of a player's hitbox is colliding with another object? I can't use the "collision status" addresses because this only works with blocks, and it's not able to be used to test for collision with a certain object. If not, I can just create a collision sensor on each side of the hitbox, but that will take a lot of work because players change size, and characters may have different hitboxes and hot spots.

2) How big are each character's hitboxes and where are their hot spots? (If the answer to 1 is no)

3) What position do objects have to be in for it to count as a collision? Is it if at least 1 pixel overlaps, or do they only have to be right next to each other (without pixels between)?
Image
Current Project:
Image

Hoeloe F
Nice citizen
Nice citizen
Hoeloe F
Nice citizen
Nice citizen
Reputation: 5
Posts: 16
Joined: 3 Nov 2014

Post #2by Hoeloe » 26 Oct 2015, 20:45

Sambo wrote:I have a few questions about the Colliders library:
1) Is there a quick way to tell which side of a player's hitbox is colliding with another object? I can't use the "collision status" addresses because this only works with blocks, and it's not able to be used to test for collision with a certain object. If not, I can just create a collision sensor on each side of the hitbox, but that will take a lot of work because players change size, and characters may have different hitboxes and hot spots.

2) How big are each character's hitboxes and where are their hot spots? (If the answer to 1 is no)

3) What position do objects have to be in for it to count as a collision? Is it if at least 1 pixel overlaps, or do they only have to be right next to each other (without pixels between)?

Currently no, unless you use the raycast system, which isn't really the same thing. You can do a basic coordinate check, though, which might get the results you need, depending on the use case.

You can get the size of the hitbox directly from the character code, but Colliders also has a "getAABB" function, which gets the Axis-Aligned Bounding Box (Box collider) that fits that object. By calling that on the player, you'll get the standard player hitbox, and you can then use that as a guide for other hitboxes.

The collisions aren't based on "pixels", they're calculated mathematically. If every collider object's position is an integer, then it will be pixel-based, but that's very unlikely to happen, especially if you're using the player, so I wouldn't try to consider that as something you can rely on.

Sambo M
Topic author, Count
Count
Avatar
Sambo M
Topic author, Count
Count
Age: 25
Reputation: 15
Posts: 264
Joined: 27 Jun 2014

Post #3by Sambo » 31 Oct 2015, 8:44

These variables listed in the wiki are not defined anywhere in your API:
These variables don't exist.PNG

When I tried to use them, it threw an "attempt to index nil value" error. I used the find function in N++ and it did not find these variables anywhere in the file.
It does have these variables in the newest version, but for some reason the BLOCK_SOLID table is empty. I just filled it, and I think I understand why you didn't now. That was one of the most boring half-hours of my life. If you want, I can upload that so you don't have to do it.
Image
Current Project:
Image

Hoeloe F
Nice citizen
Nice citizen
Hoeloe F
Nice citizen
Nice citizen
Reputation: 5
Posts: 16
Joined: 3 Nov 2014

Post #4by Hoeloe » 10 Nov 2015, 3:36

Sambo wrote:That was one of the most boring half-hours of my life. If you want, I can upload that so you don't have to do it.
Uhh... It fills itself when you start the game. That was some wasted time of yours, unfortunately.

Sambo M
Topic author, Count
Count
Avatar
Sambo M
Topic author, Count
Count
Age: 25
Reputation: 15
Posts: 264
Joined: 27 Jun 2014

Post #5by Sambo » 10 Nov 2015, 4:25

Wow... :facepalm:

I guess I should have tested it first. I feel stupid now. Oh well. I had nothing else to do anyway.
Image
Current Project:
Image


Return to “LunaLua - Extension Framework”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest