# Tag Info

1

Add this to your Sprite creation: spatial.rotate90(false); This will rotate the sprite's texture 90 degrees. From the docs: Rotates this sprite 90 degrees in-place by rotating the texture coordinates. This rotation is unaffected by setRotation(float) and rotate(float).

1

The following code creates the desired result. _ViewMatrix = Matrix.CreateTranslation(-Position.X, -Position.Y, 0) * Matrix.CreateScale(_Zoom, _Zoom, 1.0f) * Matrix.CreateTranslation(_Width / 2, _Height / 2, 0.0f); This will cause the camera to zoom into the center of the screen instead of the top left corner. ...

0

Please note that I don't have unity, but my example is in c# so you'll be able to follow along. First, since your question concerns a bike (assuming it'll always be on the ground), I've taken the liberty to 'flatten' the question and use only the x and y attributes of the used directions as in this context the z is irrelevant. The way I'd do it: ...

1

If the targets velocity is V and the interceptors desired speed is S: Calculate the normalized vector U between the interceptors current position and the targets current position Tp - Ip. Find a such that the length of Vi + aU equals S. aU is the desired speed. It will take distance / (Vi + aU).length time to intercept. If you get a negative value for a ...

0

I know you're asking about a sequence of random positions, but if you aren't restricted to generating the set sequentially, there's another approach: generate a set of points that has the desired spacing. What I think you want is a set of planets that are reasonably spaced with some randomness. Instead of generating planet positions with a random number ...

0

Think of the difference between 1 dice and 3 dice. 1 Dice gives you an even probability for all values, while 3 dice will tend to have a higher probability for the values towards the middle. The more "dice" in your equation, the stronger your chance to get something towards the centre. So let's define a function that can handle any number evenly: // Takes ...

1

I am not sure the problem is fully specified by the question, but I can provide some simple ideas, the second of these will provide numbers roughly in accordance with what your picture indicates you want. Either way as you may realize the distribution function is changing after each number generated, and has a memory (ie: it is non-Markovian) and either ...

8

If you do know the distribution you want, you can use rejection sampling. Simplest way: In the graph above, pick points at random until you find one is below the curve. Then just use the x-coordinate. For the actual distribution, there are various plausible approaches. For example, for planet number i at location p, and some strength parameter k (e.g. ...

1

If the incoming points are indeed represented as a vector then you have to touch every single one of them, or else you wouldn't be able to tell if it is within radius distance. But, you might be able to speed up your computation if you have control over the data structure used to represent your point set. For the sake of simplicity, let's assume the task ...

0

The mark over the R suggests it is a vector. So does your reasoning. As for where the equation comes from, that is the whole point of that section of the book. The purpose of the 2D to 1D diagrams is to simplify the explanation of converting 3D to a 2D screen. If the material didn't sink in, read it again. Research other sources for different ...

2

First generate a random 3D rotation matrix. Then for each frame compute a simple, boring rotation vector around the center (e.g x = r*cos(k*t), y = r*sin(k*t), z = 0), multiply it by the rotation matrix, add it to the center of the sphere, and you have a random orbit.

0

Create arc with progressively larger radius and shifting origin see this demo to get an inspiration http://www.tutorialspark.com/html5/HTML5_Canvas_Arcs.php

3

Cross product the two vectors N = V x Z where N is the rotation axis. Calculate the angle to get an axis angle representation. dot( A, B) = len(A)*len(B)*cos(theta) if A and B where normalized vectors then dot( A, B) = 1 * cos(theta) So we can get the angle using cos-1 theta = cos-1( dot(A,B) ) 3.Now we have an axis angle representation ...

1

Since vector V had been normalized you know the length of vector V and Z will be the same; V has length 1 since it had been normalized, and Z has length of 1 since it is( 0, 0, 1). Good job :D now the only thing left to take care of in order to make Z vector V is it's orientation. You will want to get rotation matrix of V then combine it with ...

2

Prepare your polygon Set up your polygon as a directed sequence of points / lines. This is described in any point-in-polygon test, for which there are countless resources online and on Stackoverflow / Stackexchange, so I won't repeat here. Prepare your map for querying Assign every grid square a unique ID. Construct a list of all unique vertices ...

1

The picture you posted seems to be seen from a 45° angle. This perspective is sometimes informally called "bird view". More formally, it is usually referred to as orthogonal, dimetric projection. Orthogonal means that all the world-axis are all parallel to a screen-axis (world-x is parallel to screen-x, world-y and world-z are parallel to screen-y). Dimetric ...

1

I made some searches and found that B-Spline have a continuous C2. I implemented it and it looks fine, even if it's an approximation and not an interpolation (it doesn't go through the samples). B-spline (approximation):

3

In Ken Perlin's paper on improved noise, he mentions a very similar problem. The cubic used in the original noise paper creates discontinuities at the integer boundaries due to the properties of its derivatives. In his revised paper, he proposes an interplant of 6t^5 - 15t^4 + 10t^3 to address those issues.

1

TimeUtils.millis() Maybe you mean to do: final long floatyPeriod = 3000; //3 secs long now = TimeUtils.millis(); long delta = lastTime - now; lastTime = now; object.floatyTime += delta; if (object.floatyTime > floatyPeriod ) object.floatyTime -= floatyPeriod; ... float value = (float) ( amplitude * Math.sin( 2 * Math.PI * frequency * ...

0

The first thing you need to adress is wheter the rotation speed or spin before hitting the wall; lets say Si; is greater, equal or lower than the value needed to maintain the same spin after hitting, say Ss. With this you can get the actual after hitting spin, say Se, using a friction value between the ball and the surface Get the velocity component across ...

0

If you are sure you don't want to just spawn another close behind and follow normal physics, then save the first projectile's previous position with the desired delay and use that value.

0

OKi was way off. This is how i got it to work. rotationTarget = Camera.main.ScreenToWorldPoint (Input.mousePosition); var _lookRotation = Quaternion.LookRotation (transform.position - rotationTarget, Vector3.forward); _lookRotation.x = 0.0f; ...

1

If you're using speed (particularly variable speed) until some target position (especially if the target can move) is reached, it's not really LERPing. That's more akin to steering. If you do have a fixed distance to cover and a fixed speed then you can easily calculate the time to LERP over. Remember the units of speed are units of distance over units of ...

3

Yay! I did it! I'm using simple simulation that takes the first position to cross the horizontal axis of the target point - from there, I take the previous simulated position and make a segment. Now I check whether the target point is below this segment. If it is - we can jump there. It's a player-controlled character on the gif. Pink is the predicted ...

1

The first derivative of the spline points along it: this is the axis which you rotate the roadway about in order to cant. The second derivative is (roughly) the curvature. The second derivative points "in" to the curve. So in a perfectly circular track, the second derivative at each point points directly towards the center of the circle. If you cant so that ...

2

You might want to "just calculate" the answer but I'm sure that you'll find it insufficient once you've got it because of the highly interactive nature of your "free fall" physics. Consider using a different approach: Searching. Here is how it's done for Super Mario AI: http://aigamedev.com/open/interview/mario-ai/ Searching possible pathes to get from A ...

3

As you state, the best choice is to approximate, in this case using a numerical scheme. Divide time into large timesteps (say 100-300ms), and use the parabolic approximation for each timestep. The forces are the same throughout except air resistance. The parabolic path is basically for constant acceleration, but with air resistance the acceleration changes ...

Top 50 recent answers are included