Tag Info

Hot answers tagged

4

Totally normal thing to do. You can also render your 3D to one render target and your 2D to a different render target and then draw those over each other in a later pass. That lets you do all sorts of fun tricks, like rendering the 3D in a lower and faster resolution while keeping your 2D in a higher and crisper resolution. This sort of thing is also ...


3

Rigidbody.isKinematic If isKinematic is enabled, Forces, collisions or joints will not affect the rigidbody anymore. The rigidbody will be under full control of animation or script control by changing transform.position. Kinematic bodies also affect the motion of other rigidbodies through collisions or joints. You can toggle this on/off in the Inspector, ...


3

Calculate the dot product to determine how close two vectors are. The dot product is 1 when they are exactly the same, -1 when they are exactly opposite, 0 when they are perpendicular, and decimal values when partway. So take the current direction, the target direction, then Vector3.Dot() and check if greater than .9 (or whatever threshold you decide looks ...


2

Voxels can be considered Axis Aligned Bounding Boxes (AABB)s. I suggest looking up the math surrounding collision detection and AABBs. It's actually quite simple as you can describe an AABB with just two Vectors (a maximum and minimum point). Here's a super simple example: http://www.miguelcasillas.com/?p=30 Of course AABB collision detection is really ...


2

jhocking's answer about dot product is the right answer to the question, but if you are rotating your object over time to face the right direction, inside that function you must be calculating how much you have left to rotate so that you know what direction to rotate and so that you don't rotate too far and overshoot. That means that inside that function, ...


2

Given credit to Alan Wolfe for what he said on "INFINITELY tile". A 2d perlin noise (or a 2d simple noise) will have no seam problem as far as you stay away from noise borders (defined by floatin point dimenision) Referencing the image: and said that you have chunks with 128X128 vertex, in chunk i,j you compute each vertex as : for x : 0 .. 128-1 for y ...


2

First, it won't solve your problem, but there are a few general problems with your code. The conditions for your if branch will always be true if transform.localEulerAngles.x >= 0 and <= 360. The > 270 part is redundant since if x is less than 270, it is still possible to be >= 0. If x is 0 and lookAxisX is > 0, then adding -lookAxisX will make x < ...


1

You can always try to use the clamp method: Ref: http://docs.unity3d.com/ScriptReference/Mathf.Clamp.html Example transform.localEulerAngles = new Vector3(Mathf.Clamp(transform.localEulerAngles.x, 0f, 90f), 0, 0); **This is just a push in the right direction (above is untested)


1

If you eventually end up going with the pre-rendered shadow approach, or any other texture based solution... To save some memory, and maybe also to be able to soften up the edges of the shadow (maybe even contact hardening shadows), have you considered using distance field textures? They are useful for monochromatic textures (decals, fonts and shadows!), ...


1

Moving an object without a rigidbody or a character controller is also not optimized and will slow your game down, you can check Is Kinematic if you don't want forces acting on it and it will still be more optimized



Only top voted, non community-wiki answers of a minimum length are eligible