Lets say I create many different 3D objects (Arms, legs, body, head). How would I go about making it so all of them can connect to form a body. And after the body is formed make it so they all animate in the same way. Can anyone help me in the right direction with tutorials or links on these topics?
Here are some good tutorials:
https://www.youtube.com/watch?v=q3oVAXhvQl0
https://www.youtube.com/watch?v=Ch1aJljEYp4
https://medium.com/#larissaredeker/3d-character-customization-fd95a1d57ae
And here a reddit user's answer(Named DankP3):
For body sliders you will probably want to look at blendshapes, this is done in the modelling programme. The more blendshapes you have the more complex it will get. eg. 'normal' 'thin' and 'muscular' bodies at one scale of variation and thicker eye brows at the other.... Of note though, facial morphs don't affect most clothes!
I think one of the most challenging parts will be that using the same animation on a thin character and a muscle bound character will not look good so some significant animation work may be required.
I'd probably apply hairstyle in the same way as clothes (see below), but colour can be manged for hair easily through code, swapping base colours, or textures.
For clothes, you rig to the same skeleton as the character (and you will need the same blendshapes to fit the body or if your body is to change shape). A lot of people put all clothes in the same model and turn them on and off as required (this intuitively seems messy), but looping through the bone array on the meshrenderer is not difficult and contrary to what the other reply says you don't need to match bones by angle and position. if you rig correctly, you can just swap, rather than match, the bones in the clothes mesh renderer for those on the character model when the clothes are put on and you are all done.
Again, all credit goes to DankP3
You can see his answer HERE.
Related
I try to begin new game development that has rotating circle that has one or many holes as in the attached image , the problem is I need to use circle collides for the big circle., in addition I need to use small collides for the smaller holes to prevent and particles(smaller circles ) input the circle and to count no of collisions occurred
enter image description here
The circle collider itself does not have this functionality since it can only check collisions between perfect circles. (Behind the scenes all circle colliders just check the distance between points and these distances do not work with holes) The best solution I can think of would be to use a polygon collider and make a rough circle that you can then remove parts of (would require some advanced geometry but not impossible). I have tried simillar things in 3D and with the mesh collider, removing parts of it using a method known as CSG (Wikipedia) and something simillar should be possible in 2D however it is really, really hard and even experienced programmers struggle to come up with a system that can handle every scenario.
All hope is not lost though, depending on what you need the collision for, there might be other ways. If you just need to check if two objects intersect and don't want rigibodys and stuff to interact with the collider just checking the distance between the big circle and the object (too figure out if it's close enough) and then checking the distance between the object and the holes (too see if it's inside a hole on thus not colliding) is the best way to solve the issue.
I'm sure someone who have done more in this field than I have will be able to help you out but without more information of what you need it's impossible to say. It all depends on the circumstances!
let's say that i have a Blender Snake Model , what is the best practice to move it and bend it while collided like a real snake body. i tried to divide it but using the InvokeRepeating() gave it the old school snake game movement plus a bad harmony between the inputs(update) and the InvokeRepeating(), also i did the part follow the previous part method but it's have some glitches while rotating and distances problems. so is there any other good practice ??
this is an image from google of how a snake (model) looks like XD and how the movement looks like ex of a bended snake Model from google
Possible solutions
Solution 1
Use rope-like physics and experiment with which parts of the snake must invoke movement and which parts must only be moved by the other parts. As well as how much each part should move.
In this situation you may benefit from making weight points in the snakes body parts, to make it seem more realistically moving.
Solution 2
Another way to somewhat achieve it would be to make the classes SnakeHead, SnakeBody and SnakeTail.
When Snakehead then moves, he afterwards tells the nearest body part to move, which tells the next body part to move and so on till you reach the tail.
That way you can have them move closer to where the body part in front of them was a moment ago.
Solution 3
Follow this tutorial: https://www.youtube.com/watch?v=xz8Ga9er3_8&feature=youtu.be
I'm working on a 2D physics game that involves collisions between objects which at the moment use complex polygon colliders.
When the objects collide, I get the normal of the contact point using otherObject.contacts[0].normal, and knock the objects apart in equal-but-opposite directions using Rigidbody2D.AddForceAtPosition, with the force being the normal multiplied by a constant.
Most of the time this works flawlessly, but I've found that when the collision occurs with a concave section (aka: an inward "dip") in the polygon collider, the normal will be flipped, and the objects will instead get pushed towards each other.
Alternatively, are there any other ways I could go about solving this?
The blue circled area is an example of a problematic concave section
Alternatively, are there any other ways I could go about solving this?
Yes, the standard thing in vid games is that most stuff has many small simple colliders, rather than one large complex collider.
This is a basic of game engineering.
(It can be very surprising to hobbyists and folks new to the field.)
So, imagine a car in any ordinary 3D game. You'd have a collider for the rear bumper, one for the front, maybe one for "left doors" and so on. Very typically, each has to react in a different way, and you need to know which area was touched.
In your case if the 2D poly has say 12 edges, just make 12 "small" as it were colliders for each of the edges.
We know nothing about your setup since no screenshot, but that could possibly work.
Note however that Unity's 2D poly collider in fact already does know to slice the object in to smaller triangle-like shapes if it is concave - I'm surprused it dinnae work for you.
Further: now that we can see your image.
In any video game on Earth, the way you'd do that helmet is with a square collider as in orange:
If (for some reason .. why? for what purpose? how? where? what possible reason could there be?) you were making the most precise video game, ever created by humans, on an entirely new plane of engineering, for some imaginary new hardware with quantum warpspace cores, ... in that case ... you'd maybe add the two extra colliders to cover the horns. But nobody would ever notice the difference.
I appreciate you may be doing something exceptionally unusual, like a "close up game" ("you're an atom in medieval Scandinavia, bouncing off helmets" or whatever), in which case there'd be some other solution.
The very short answer is you've stumbled on one of the most surprising things about game technology ... we use crappy, simple, colliders, you've been tricked all your life in every title you play!
Is it possible to make some % of my mesh transparent?
For example, imagine I have a mesh that is a house. At first the mesh is transparent. As a person clicks on the house, it becomes opaque along the Y-axis so it looks like it's being built up.
Any ideas how to approach this problem?
"a house. At first the mesh is transparent. As a person clicks on the house, it becomes opaque along the Y-axis so it looks like it's being built up"
Literally in answer to your question, in general:
I would approach this by making a shader which was sensitive to the global Y value of the point in question. It would use that value, over time, to decide on alpha at a given point.
alternately
Imagine a second texture of the house, call it GUIDE, which is: imagine a monochrome house: at the ground it is black and it slowly becomes pure white at the tops. Additionally you could color it any way you want, for example, the window frames and quoining could be black and so on. Now, the shader would use the GUIDE texture as a key, to know at what time, that area, should become transparent.
That would actually look quite incredible and offer amazing control. You could fade in different parts in whatever order you wish.
It would be beyond the scope of an answer here to actually engineer this. But I believe the key here is, unfortunately for what you describe that is really all done in the shader, I'd say.
Note that if you just want "a clean hole", look in to approaches using a depth mask shader And indeed https://www.youtube.com/watch?v=s3RKGAj9Uzk
for 2D consider this, http://answers.unity3d.com/questions/449034/see-through-hole-via-shaders-on-a-2d-plane.html
in other cases you may literally want to cut a sharp hole in the mesh which is a "whole" different technology. https://gamedev.stackexchange.com/questions/72978/shader-that-cuts-hole-through-all-geometry
if you want this effect http://answers.unity3d.com/questions/622089/how-can-i-render-a-semi-transparent-texture-with-a.html (see mario image) that's totally different again - it's nothing more than a gray image with a hole!
A recent question here made me think of SceneKit again, and I remembered a problem I never solved.
My app displays antenna designs using SK. Most antennas use metal rods and mesh reflectors so I used SCNCylinder for the rods, SCNPlane for the reflector and SCNFloor for the ground. The whole thing took a couple of hours, and I'm utterly noob at 3D.
But some antennas use wires bent into arcs or helixes, and I punted here and made crappy segmented objects using several cylinders end-to-end. It looks ass-tastic.
Ideally I would like a single object that renders the arc or helix with a cylindrical cross section. Basically SCNTorus, but with a start and end angle. This post talks about using a UIBezierPath in SK, but it uses extrude to produce a ribbon-like shape. Is there a way to do something similar but with a cylinder cross section (like a partial SCNTorus)?
I know I can make a custom shape by creating the vertexes (and normals and such) but I'm hoping I missed a simpler solution.
An arc you can do with SCNShape. Start with the technique from my other answer to get an extruded, ribbon-like arc. You'll want to make sure that the part where your path traces back on itself is offset by a distance the same as your extrusion depth, so you end up with a shape that's square in cross section.
To make it circular in cross section, use the chamferProfile property — give it a path that's a quarter circle, and set the chamfer radius equal to half the extrusion depth, and the four quarter-circle chamfers will meet, forming a circular cross section.
A helix is another story. SCNShape takes a planar path — one that varies in only two dimensions — and extrudes it to make a three-dimensional solid. A helix is a path that varies in three dimensions to start with. SceneKit doesn't have anything that describes a shape in such terms, so there's no super simple answer here.
The shader modifier solution #HalMueller alludes to is interesting, but problematic. It's simple to use a modifier at the geometry entry point to make a simple bend — say, offset every y coordinate by some amount, even by an amount that's a function of why. But that's a one-dimensional transform, so you can't use it to wrap a wire around on itself. (It also changes the cross section.) And on top of that, shader modifiers happen on the GPU at render time, so their effects are an illusion: the "real" geometry in SceneKit's model is still a cylinder, so features like hit testing apply to that and not to the transformed geometry.
The best solution to making something like a helix is probably custom geometry — generating your own vertex data (SCNGeometrySource). The math for finding the set of points on a helix is pretty simple if you follow that shape's definition. To wrap a cross section around it, follow the Frenet formulas to create a local coordinate frame at each point on the helix. Then make an index buffer (SCNGeometryElement) to stitch all those points into a surface with triangles or tristrips. (Okay, that's a lot of hand-waving around a deep topic, but a full tutorial is too big for an SO answer. This should be enough of a breadcrumb to get started, though...)
Here are some starting points that might help.
One approach would be to use more cylinders and make them shorter. That's the same idea behind the various segmentCount properties on the SCNGeometry primitives. Can we see a screenshot of the current linked cylinders version?
If you increase the heightSegmentCount, you could use the approach outlined here: scenekit, how to bend an object.
I just took a look at SCNShape. I was thinking you could use a shader modifier to warp the extruded shape into a circular cross section. But SCNShape doesn't seem to expose a segment count property, which I think you'd need to create enough extrusion segments for a good look. The chamferRadius and chamferProfile properties look interesting. I wonder if you could use those to create an extrusion that looks good.