Tag Info

Hot answers tagged

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. ...


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, ...


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 ...


2

Just rotate the point at an angle of -θ around the center of the rectangle. relx = x-cx rely = y-cy rotx = relx*cos(-theta) - rely*sin(-theta) roty = relx*sin(-theta) + rely*cos(-theta) dx = max(abs(rotx) - width / 2, 0); dy = max(abs(roty) - height / 2, 0); return dx * dx + dy * dy; Also, remember this is still the distance squared, so you need to take ...


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 = ...


2

If you write a 1 for a connection and 0 for lack of connection, and have 8 sides, then you can write out the configuration of an octagon as a bit string. I'll order them as east, northeast, north, northwest, west, southwest, south, southeast. If north and west are connected to neighbors and other directions are not, this would be written 0 0 1 0 1 0 0 0. ...


1

Unless you want to allow octagons to overlap (when you would, you would be in quite a lot more trouble), it is impossible for two adjacent edges (a diagonal and an orthogonal) to be both connected to another tile. This makes stuff a lot easier. Separate each of your octagons into 9 tiles like this: You need one set of tiles where the diagonals are ...


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.


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 ...


1

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



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