- Home /
How to make a glue gun?
I am planning on making a puzzle platformer, and my gameplay method will be fps, and I will have a weapon that would place a glue on any surface that the ammo would touch (basically I would put glue on the floor). I know that to make stuff stick then I would make it create a joint on anything that has a collision to it, but what I don't know is how to make the glue itself. One possibility is to make the gun spawn many, really small spheres that would have the "joint creation" script on it, but I was wondering if there is any other suggestions. Scripts for my glue or your ideas would be appreciated as well.
By the way, any script you have I would like in java if possible. THanks.
Java isn't supported in Unity. (Yes, I know you mean javascript, aka Unityscript, but since Java and javascript are completely separate languages, the names 'Java' and 'javascript' really shouldn't be used interchangeably.)
Thank you Jesse for the correction (and I do not mean that sarcastically, I only started using this program less than a week ago, and while I know the basics, I am far from being an expert).
Answer by Jason B · Dec 28, 2010 at 12:38 AM
In thinking about this for a while I can't think of a good, FAST way to do it that wouldn't require a lot of crazy math.
The "create a sphere for every blob of glue" is pretty much the easiest solution I can think of, but I would recommend not using an actual sphere for the model or your polygon count will quickly shoot through the roof. You may instead want to use no model at all, an invisible rigidbody with a collider in the shape of a sphere, and perhaps a decal for the glue splat.
Or be careful to limit the amount of glue blobs in play at one time, and model a special low-poly blob that has no polygons behind it to stick to surfaces, for performance's sake.
Another tip for not letting the game be overrun with too many glue blobs in one spot would be for each new blob to detect other blobs around it, and if it's too close, it doesn't stick. Then you could get a natural, even coating of the glue without it crowding and causing unnecessary lag.
Thanks for the support, and when you say decal, you mean make it spawn a picture of the splat on the surface it hits when it collides with the surface, Right? Also, when you say it doesn't stick, I would also assume that you are saying to delete as well if it enters those perameters. Sorry for all the questions, I am new to Unity.
Also, I want a solvent, and something I was thinking of was creating a script that deleted itself as well as the object it collides with, but only if it collides with a specific object. Even just a part of script that would show how to make it work with only that object.