Tag Info

New answers tagged

0

Assuming your vertices haven't been multiplied by any matrices the tangent and bitangent will be in object space. Edit: Your vertices are in object space. A normal is a vector perpendicular to a face (usually a triangle made from 3 vertices). Because the vertices used to calculate the normal are in object space, the normal will be also. The same follows ...


3

The problem your having is that motion in games, as smooth as it might look, is better seen as a series of short teleportations. So, since distance is an unsigned value (always greater than zero), your car is just teleporting right past the absolute distance of zero. That causes the check to never go off. You have 3 options: You can add a margin of error ...


1

You could re-order your std::vector<Object> by creating a function that sort it by Y position of your objects void SortObjects() { std::sort(Object.begin(), Object.end(), CompareYAxis); } bool CompareYAxis(const Object first, const Object second) { //Do the comparison here } I think this would work.


0

To simply fix your error: after the line self.dx,self.dy = self.mouse try adding self.dx -= offsetx self.dy -= offsety Note this is not an ideal solution. In general though to avoid similar future problems I would further separate the concept of screen space and world space, possibly by the addition of something like a "camera" class. You could even add ...


0

To expand @Alexandre Vaillancourt answer, I would even consider using a collection that keeps your data sorted, instead of re-sorting it every frame. struct Drawable_compare { bool operator() (const IDrawable& d1, const IDrawable& d2) const{ return d1.y < d2.y; } }; class Renderer { private: std::multiset<IDrawable*, ...


1

I would forget right away the option to create the sprites in order based on their y coordinate as it will create a hell for you because it's not a flexible design. You look like you need a common way to handle the drawing process. You can achieve this using polymorphism. I would probably create a IDrawable interface, which requires children to have ...


3

I found the solution myself. Here's what I've done: I took the default forward rotation of the firingPoint object, and split it into it's parts - x, y, z, w. Then from these floats, I create a new Quaternion using the constructor method: float randomX = Random.Range(-0.1f, 0.1f); float randomY = Random.Range(-0.1f, 0.1f); float randomZ = ...



Top 50 recent answers are included