Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Tag Info

New answers tagged vector

1

At the beginning of your game you could create a list of Steps (it would contain either the transforms or the colliders of all the steps of the scene). Every time the player presses down, you run through your list of Steps and try to find the closest one (using Vector3.Distance between player position and step position, it should be easy to determine the ...

2

This is an old question but to put in to less technical terms, a Vector3 is a "container" for 3 float values - x,y,z. You can compare individual values, such as comparing the x values of two Vector3s, because they are just numbers. However, an entire Vector3 cannot be compared to another Vector3 because there isn't a single value that can be used to ...

1

A few rules of thumb around this, if the calculation only needs to be done once and applies to the entire object, then you will get best bang for buck calculating it prior to loading onto the GPU. IF though the calculation does change then you also need to consider where in the GPU pipeline it should be calculated. For instance, if you can calculate the ...

0

The CPU could perform the calculations in a faster rate than a GPU due to higher clock frequency. However, the GPU can do a lot more calculations in parallel. If you are working on a large data set, where you operate on each item in the same way, the GPU can be a lot more efficient, however it requires some setup, like uploading data to the GPU, executing a ...

1

To inverse the spawn point and other useful methods: // renamed double Vector2::AngleRadOther(Vector2 other) { return atan2(y - other->y, x - other->x); } // renamed double Vector2::AngleDegOther(Vector2* other) { return radiansToDegrees(AngleRadOther(other)); } double Vector2::AngleRad() { return atan2(y, x); } double Vector2::AngleDeg(...

1

It turns out I was probably overthinking this quite a lot. The solution in the end was to just calculate the rotated position of the object by rotating their current position Vec2 by the inverse of the camera rotation. I could then sort by this rotated Y value.

Top 50 recent answers are included