Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(1 edit) (+1)

For each signature the game spawns a gameobject with a linerenderer component that adds points whenever the mouse is dragged to a certain delta distance. the points on the component are logged in local space, and the object is updated to follow changes in the page's position, rotation, and sorting layer.

whaaaa...?

I see... While that makes no sense to me right now, this is defiantly the clue I needed! Thanks so much fellow human!

hei... could you explain more about this mechanics....

how did you logged the local space of the line from the paper object

Unity's line renderer component keeps an array data structure in lineRenderer.points storing point values. Whenever I want a new point on the line, I add a value to the back of this array. To have the points be in local space you can set lineRenderer.useWorldSpace to false.

how did yoy guys set the boundary for the sign... I notice there is this rectangle on the paper, and yoy can only draw in that rectangle...

(2 edits)

On each signature there's an invisible rectangular region that tracks whether the mouse is hovering over it. With Unity UI you can do this out of the box with an Event Trigger component. In the code there is a check that only adds points to the signature if the rectangle is currently detecting a mouse hover.

Oke... I've figured most part now, one more question, how did you change from draging to drawing the signature? I'm acttualy put collider on my mouse hover, and collider to my sign place, so when they collide, i can draw a signature, but it seems this method is not a clean solution for this case, as i draw, mw paper also move with me

If you're doing the signature region using Unity UI, you can have it so that the signature hitbox blocks raycasts by adding a Canvas Group component to it. This will make it so that whenever Unity detects that you're hovering over the signature region, it blocks it from also detecting that you're hovering over the paper object behind it.

wait... So the paper and table is in UI? Not gamespace?

Yea I programmed them with Unity UI because it automatically handles raycast blocking and mouse events. But I set all UI canvases to render in world space so that I can move them around like normal game objects.

Ahhh... that's explain everything... i'll try it later... right now i'm joining jam hahaha.... weekly game jam actually.... Ty for your kindness sir, i'll ask again if i have problem...