Tag Info

New answers tagged

0

Take a look at Renderer Bounds Which gives you a world space AABB that you can use to determine the scale along the axis. Now if you have a rotated loading bar you can just use the transform's lossyscale to do a similar thing but the rotation will make it slightly inaccurate. Once you know the scale along an axis you can use an origin point to define an ...


0

The bounding box you described is intersecting the frustum, even if your visualisation isn't making it apparent. At a position of 0, 10, 0, and the camera's position at 0, 3, 10, the difference in position is 0, 7, 10. Further, the difference of position from the camera to the top-most near corner of the 2x2x2 box is actually 0, 8, 9. With a FOV of 60 ...


0

The question sounds like it is describing a problem with object penetration. (When one circle is overlapping the other and it causes the deflection to be calculated wrong). This is a problem with the precision of the collision tests. If I have understood the problem correctly, what is happening is that collision detection only happens once per frame but the ...


0

Beware of the argument order here. Here is what atan2 will give you: atan2(x,z) is the angle between the (x,0,z) vector and the +Z axis in the Z-X plane. atan2(z,x) is the angle between the (x,0,z) vector and the +X axis in the X-Z plane.


0

Your solution is correct, but only for a very specific type of collision. Even the gif is really only valid if a moving circle hits a stationary circle - not if two circles are moving and hit each other. Since you probably want to be able to make this work regardless of how the circles are moving when they collide, you'll need to do some calculations. ...


0

Here’s a little example. Suppose you slerp q0 and q1 with a value of t = 0.2 and a value of t = 0.4. This gives you a quaternion s(0.2) and a quaternion s(0.4). Quaternion multiplication also gives us the following: s(0.2) = q0 * inverse(q0) * s(0.2) '——————— K ————————' So we have a value K which, when right-multiplied with q0, gives us ...


0

Part of what you are looking for is an understanding of map or sphere projections. http://en.wikipedia.org/wiki/Map_projection A rectangle is not a sphere. (I know it's obvious, but useful to state.) To map a rectangle onto a sphere, you have some choices about how to do it. Your picture looks like it's an "equirectangular" mapping, which maps vertical ...


1

Expressed as a GLSL fragment shader (untested): const float M_1_PI = 1.0 / 3.1415926535897932384626433832795; const float M_1_2PI = 1.0 / 6.283185307179586476925286766559; uniform sampler2D texture1; varying vec3 v_normal; void main(void) { vec3 n_normal = normalize(v_normal); vec2 texture_coordinate; texture_coordinate.x = 0.5 - ...


3

Why not this way? Much easier? damagePerSecond = averageDamage * fireRatePerSecond * accuracy Example: damagePerSecond = 140 * 10 * 0.09


0

DPS = (total / rate) * accuracy; so for shotgun: damagePerShot = 140; totalPerSec = damagePerShot * 10; dps = (totalPerSec / 100) * 9; so I figure average dps of 126 for a shotgun. Sound Good?


0

You have 3 points, P01, P1 and P2. (Look at the figure right above the equation.) The points create a triangle. This triangle lies on a plane and on this plane are the two vectors T and B. (Tangent and Bitangent) These vectors are more or less random, optimally they are at a right angle, but this may not be the case, the only requirement is that they are not ...


2

Iterating through the faces: faceNormal[i].dot(-worldViewVector) > 0.8 //(should actually be >0.9999) If you do an if/switch to apply a rotation to the cube(or camera): Just update and store a value indicating the front face at the same time. This actually works the same for non-snapping angles such as your scene view. In the orthogonal mode, the ...


0

For the Bezier curve - straight line case, the most accurate way to find the answer is to do the following: Transform the problem so that the straight line is always horizontal at Y=0. This is done by multiplying all the control points by an appropriate affine matrix. (I assume you are familiar with representing affine transformations of the plane with 3x3 ...


0

Ok so I found the solution, and thanks for you replies. The linem_player->GameObject::setPosition(m_player->GameObject::getPosition() + dir); was only updating the gameobjects position variable, this variable only took effect on the gameobjects update. Which why of course it worked when there was only one wall. But with a second wall, it would ...


0

if (col.left) dir.x += (wall.getPosition().x + wall.getHalfSize().x) - (m_player->getCollider().getPosition().x - m_player->getCollider().getHalfSize().x); else if (col.right) dir.x -= (m_player->getCollider().getPosition().x + m_player->getCollider().getHalfSize().x) - (wall.getPosition().x - wall.getHalfSize().x);


0

A possible explanation for this is unrelated to the corners: to determine whether it's colliding left or right, or if it's colliding up or down, instead of checking how far inside the player's hitbox is within the wall you should check the direction of the player's movement. It would go more along these lines: CollisionData testPlayerCollision(const ...


0

I know this is kind of a cop-out, but I bet you can get a lot out of the Doom source code on github: https://github.com/id-Software/DOOM It has spurred more than a couple Doom-likes and at the very least is maintained well enough that you could emulate a lot of the implementation there and still be very original. Even if you don't have linux to compile it ...


1

I can see why you would want to do that, if the random number was a key seed to a sequence, having the same number twice would create the same sequence. You could create a table to use as your randoms at program start time, then check it for duplicates, and replace with another random till every number is unique. If you add all the numbers to a map while ...


2

That sounds really odd to me. This might sound like a good idea if you've got some bad/biased RNG. Another possible use case would be some game with random loot where you'd like to guarantee your player to get some special drop once every x tries rather than having a very bad streak. However, for your own use case this doesn't sound very useful at all, ...



Top 50 recent answers are included