Tag Info

New answers tagged

0

There is a realtime WYSIWYG interpolation editor: http://inloop.github.io/interpolator/


2

If you have the normal vector for the "top" face of the hex and the vector for the directional light it should be easy to determine if that hex is facing the light. Note that this will check if the hex and the light are facing each other. This will not detect of another object is in between casting a shadow over the hex. Vector3 lightDirection = ...


1

Interesting case. One way I can think of solving this would be to have an up normal on each hex tile. You would dot each hex's normal with the light source direction vector, and if the angle between them is more than 90 degrees you ignore all light calculations for the whole hex tile.


0

It is unclear as to why you are using a perpendicular. There isn't enough detail to describe the problem you are working. However, perhaps this will help. A 2D vector can be described using the values (x, y). The left hand perpendicular and the right hand perpendicular are easily calculated. The left hand perpendicular of (x, y) is (-y, x). The Right hand ...


0

In neutral position you have defined forward to be the positive Z vector (0, 0, 1). There are two vectors perpendicular to that vector (if we ignore sign), up (0, 1, 0) and left (1, 0, 0). The easiest thing would be to create all three vectors and to apply a matrix transformation to find the left, up, and forward vector in 'camera space'. Matrix transform ...


2

The vector between A and B is B - A. The magnitude of this vector is the distance between these points. If point A is traveling along this vector then it has reached point B when the magnitude is 0 and it passes B when the vector components change signs (positive to negative, or negative to positive) as compared to the original B - A vector. For example, ...


0

Here's how most people start out in it for "basic" terrain height maps ... Create my volume (voxel array). Generate a Y value for each x,z im interesting (terrain heightmap generation). Loop through a column of voxels from 0 to terrain height and set their values as "inside the volume" (on). Generate a mesh based on examination of the volume by looping ...


2

When facing this problem I found that I wanted the character to move forward at a velocity roughly proportional to how close they are to facing the target. When facing away from our target we "turn on the spot" (Red), when facing directly towards it we walk straight towards it (Green), when somewhere in between we will may walk slowly while turning (Blue ...


0

Your top code chunk is: t2 * (t1 * direction * inverse(t1)) * inverse(t2) Your bottom chunk is: t3 * direction * inverse(t3) Given that t3 = t2 * t1 It's (t2 * t1) * direction * inverse(t2 * t1) As far as my knowledge of Quaternion multiplication goes, I don't think t2 * (t1 * direction * inverse(t1)) * inverse(t2) and (t2 * t1) * direction * ...


1

He's trying to oscillate between V and V+U*0.01+R*0.1, I think. If you want to visualize, it is trying to do something like the picture below: The arrow at the top represents the path DIR will take as time proceeds and it will go back to V when the sin value becomes zero. The summation, just adds the 'perturb' effect to the DIR vector, so that it doesn't ...


4

The three component vectors right, up, and forward probably point along the axes x, y, and z relative to the camera. So by adding these vectors together you can compose any other vector. It works the same as if you built a vector by specifying its three elements individually, except that you are adding three vectors which each have one non-zero element. ...


1

There are a few ways to move along at a constant speed along a path whose "segments" are not a constant length - and it's not trivial to make them that way. I would approach the problem by making a "Mover" of sorts which follows a "Path". public interface Path<T> { public T getPoint(float delta); } public class Mover<T> { public ...


8

tl;dr func 1 1 - 2 * |(x mod 2) - 1| Or in your specific case: 1 - 2 * |((time % entireDay) - halfDay) / halfDay| You can even use a sinus wave instead (much more pretty). sin(x - pi/2) Sin Wave Or in your specific case: sin (- pi / 2 + 2 * pi * time / entireDay); Long tedious explaination in fine detail: If in military time: 00:00 ...


1

Imagine the radius is one. That means every point around the circle is exactly one unit away from the center. Now what kind of vectors always have a length of one? Unit vectors of course. You can get a unit vector by normalizing a non-unit vector. Take the vector CA (center to A). Next, normalize CA to make it a unit vector, then scale it by the radius of ...


1

As I can see the hex game objects have a mesh collider. So you can use SphereCastAll using your hex center position as origin and hex radius * 2 as radius to grab every neighbors colliders. It's surely not the most elegant way to do it but it sure avoid headaches :)


1

you could keep references to them in a kind of an array like this so you'd get the neighbours just with indexing, like in a 2d grid: http://stackoverflow.com/questions/6661169/finding-adjacent-neighbors-on-a-hexagonal-grid and http://stackoverflow.com/questions/4585135/hexagonal-tiles-and-finding-their-adjacent-neighbourghs/15524441#15524441


2

In order to compute left and right, you need the concept of "up". For instance, if you are flying a spaceship and performing a "barrel roll" then the concept of "up" changes and with it, left and right change as well although you are facing in the same direction. Up can be based on the plain the character is standing on or simply be an absolute direction. ...



Top 50 recent answers are included