updateHitboxes function

Ok, so this was originally going to be a help post asking about a way to update the hitboxes, but I decided to do some digging in how the hits() function works

So, first of all, the “hits” function contains 3 functions for the 3 modes:
rectangleHits(), circleHits(), and convexHits()

I haven’t gone through the circle function, and the convex function is too long for me to explain (or comprehend right now, cuz i dont have enough time), but the rectangle function uses the absoluteBounds property for both objects (there’s actually a TODO comment to change this to a method that doesn’t rely on paper.js rectangles)

After a small test, I have confirmed that absoluteBounds does not update until the end of a frame, which does make sense.

Although I haven’t done too much testing with it, I’m currently seeing if just moving the absolute bounds with the clip fixes this, (however, it uses the top-left xy instead of origin x and origin y)

I haven’t actually tested this method yet, and I’ll give an update on if it works or not later

Original help post

This text will be hidden

What Wick Editor Version are you using?

Describe the Problem
Basically, I’m having problems because hitboxes only update at the start of the frame.

This makes any form of collision difficult since collision is only registered after all of my code, so if a clip moves then checks its hitbox, it checks based on the previous frame, instead of its new position.

Basically, I want to know if there’s some wick function that updates the hitboxes.

1 Like

boxGame10-27-2023_12-40-36.wick (4.6 KB)
Collision works, without any “prediction” clip (which is what I always used for better collision previously)

I even added a bit to the function that allows for pushable boxes! (any clip that starts with “b”) without weird jittering

I have figured out how to update convex hitboxes, and made a function called move(x,y,convex) to automatically reposition the hitbox. It only moves the convex hitbox if convex is set to true, which is the default.

Updating convex hitboxes12-13-2023_11-39-46.wick (2.2 KB)