- Home /
Simulate working with items (cutting, welding things together)
I'm currently rediscovering Unity and working on ideas for a game. The focal point of the game would be a constriction mechanic. Cutting, bolting, welding, binding with screws etc. I've got a few ideas how to make that work visually but I'm not sure how to create points dynamically on an object for other parts to attach to and simulate stress on them so that the connections can break under set conditions. Ideas ?
You might want to check joints: http://docs.unity3d.com/Documentation/Components/class-FixedJoint.html Besides this option, maybe it's better to use code to manage joints, other than coding joints from scratch.
Looks good. Either a Fixed or even a configurable joint as I'd want to give the user as much freedom as technically possible (within sane parameters).
Answer by The-Arc-Games · Aug 07, 2012 at 06:57 AM
We can offer you a simple idea for this, completely based off of unity's standard capabilities:
Create your "primitive" models with bones that correspond to all the valid positions for attachments. For example, if you have a cube that can be bolted, model it in any way you need (for example with holes on the sides) and then place armature bones in those spots.
Thanks to this, you can easily use those bones in the editor, to 'clamp' the objects together, by simply moving and rotating the root transform of the model to that of the intended clamping spot.
Of course you'll need some dedicated scripting for this, but it's pretty basic, all based on transform manipulation!
Do note that you can freely add empty gameobjects in the Unity editor to achieve the same result. Using the modeling program should give you more flexibility and accuracy, using the editor should be faster (but can became painful if you need to change your model, and then re-synch the attachment positions).
I'm not really worried about the complexity of scripting. I might have worked on things that have not seen light of day and never will as far as game prototypes go but I'm no stranger to code.
I will have to investigate this idea further as fixed points of "clamping" isn't what I'm after (ideally of course. If there is no other way that's workable for any reason I'll go with fixed)
The near total freedom of construction and creation will be one of 3 things setting this apart from other games of this type so I really really need to have that polished to a perfect shine. Thanks for your input! Options are always good as I might be rusty (last time I played around with Unity was around the beginning of free version - 2.5 I think but I'm not sure)
You might want to look into http://docs.unity3d.com/Documentation/ScriptReference/Physics.Raycast.html
With this, you simply raycast from your mouse or camera into the 3d object, and deter$$anonymous$$e the point in space where you want or need to 'clamp', and thus create a new gameobject there, where you eventually add your clamping and gameobject parenting logic.