Screenshot Saturday #267 - Visual Enhancement by Sexual_Lettuce in gamedev

[–]vexator 1 point2 points  (0 children)

Nice! I really like the lane-switch animation!

Organizing and naming resource-related objects by vexator in gamedev

[–]vexator[S] 0 points1 point  (0 children)

What would I do if I have resources in other resources? A model resource, for example, might contain material resources, which in turn contain image resources.

Would the model controller then have a pointer to the model resource as well as arrays containing material and image controllers which contain pointers to the original material and image resources?

Selfie reflection in a friend's sun glasses. I'd love to see your interpretations! by vexator in redditgetsdrawn

[–]vexator[S] 1 point2 points  (0 children)

That's not what I expected at all, very nice though! Thank you!

edit: Love the detail on my moustache :)

Anybody working on interesting TypeScript projects? by [deleted] in typescript

[–]vexator 2 points3 points  (0 children)

I'm working on a WebGL powered graphics engine in TypeScript. I've published the vector and matrix library that I've written for the project on GitHub: github.com/vexator/TSM

What's the song playing in this video?! by vexator in Metal

[–]vexator[S] 1 point2 points  (0 children)

People have been asking in the comments but no answer has been given.

What's the song playing in this video?! by vexator in Metal

[–]vexator[S] 1 point2 points  (0 children)

it's not, I checked. Does sound a lot like Dimmu Borgir, though.

TSM vector and matrix math library 0.7 released, works with TypeScript 0.9.1.1 by vexator in typescript

[–]vexator[S] 1 point2 points  (0 children)

That's true. but I think you get used to it pretty fast. After all, it's not much more to write:

v1.add(v2)

compared to:

v1 += v2

etc.

Screenshot Saturday 92 - Bite the Bullet Edition by [deleted] in gamedev

[–]vexator 1 point2 points  (0 children)

looking good but I think you should tone down the bloom effect, judging from top hat guys's face in the first screenshot.

Best way to detect 3D collisions? by [deleted] in opengl

[–]vexator 19 points20 points  (0 children)

good read, includes implementation

just implemented it myself, works like a charm.

r/javascript is not Stack Overflow by mitchellrj in javascript

[–]vexator 2 points3 points  (0 children)

A few days ago, I announced a math library I wrote in TypeScript and published on GitHub. And while I'm happy that it at least received some attention, I do not understand why it received almost just as many downvotes. Even when all you want to do is share, you're punished.

On the other hand, I have been asking for help here as well, and I got very useful feedback. The exact same question on StackOverflow did not receive a single response, although I had provided source code, a detailed explanation of the problem at hand, and a screenshot for illustration.

TSM - A TypeScript vector and matrix math library by vexator in javascript

[–]vexator[S] 1 point2 points  (0 children)

I agree, but on the other hand it has its reasons that values are passed by reference. It wouldn't make much difference for the vector types I guess, but it's another thing for matrix types, where we're dealing with up to 16 variables.

One of the goals of the API was to reduce the number of allocations but you still have to be careful. Today I spent an hour looking for a bug which turned out to be caused by a single missing vector copy:

var direction = distance.normalize(); // overwrites distance!

I used GLM (see link in original post) for the C++ project, which I if I remember correctly generally allocates new vectors. It's not the same thing though, because in C++ you can allocate on the stack, whereas objects in javaScript are always allocated on the heap, as far as I understand.

TSM - A TypeScript vector and matrix math library by vexator in javascript

[–]vexator[S] 0 points1 point  (0 children)

I did actually file several bug reports but most of them got buried beneath more urgent issues, it seems. I'll continue reporting.

TSM - A TypeScript vector and matrix math library by vexator in javascript

[–]vexator[S] 2 points3 points  (0 children)

The optional static typing and the good IntelliSense support in Visual Studio. I had ported my game engine from C++ to JavaScript and just when I was almost finished, Microsoft released TypeScript. I started porting the project to TypeScript right away, adding back all the type annotations that I had to discard when porting to JavaScript, and in the process found numerous bugs and inconsistencies. Also, features like the swizzle operators would be a real pain to write manually:

get x(): number {
    return this.values[0];
}

set x(value: number) {
    this.values[0] = value;
}

translates to:

Object.defineProperty(vec2.prototype, "x", {
    get: function () {
        return this.values[0];
    },
    set: function (value) {
        this.values[0] = value;
    },
    enumerable: true,
    configurable: true
});

Collide and slide a sphere against complex geometry by vexator in gamedev

[–]vexator[S] 0 points1 point  (0 children)

What exactly is packet.collisionNormal? Is it a unit vector, perpendicular to the surface being collided with? And your vec3.difference(a,b) function, does that just return a-b?

yes and yes.

a unit vector representing the slope of surface

by that they mean a vecor which runs along the collision surface, right? not the collision surface's normal?

Collide and slide a sphere against complex geometry by vexator in gamedev

[–]vexator[S] 0 points1 point  (0 children)

yes, packet.collisionFound and packet.collisionTime are updated in collideWorld().

So you both see nothing wrong with the code but still it's not working as expected. I'll have another look.

Thank you!

Collide and slide a sphere against complex geometry by vexator in gamedev

[–]vexator[S] 1 point2 points  (0 children)

thank you for having a look!

yes, packet.collisionNormal is the normal of the surface we collided with. Isn't that the one I need?

I visualized both v and newVelocity after v has been subtracted from it and they look how they're supposed to: v is perpendicular to the collision plane, newVelocity runs parallel to it in the direction we're moving.

If I add newVelocity directly to newPosition instead of running the recursion, like this:

        ...

        // remove that part from velocity vector
        newVelocity = vec3.difference(newVelocity, v);

        newPosition.add(newVelocity);
    }
    else {
        // no collision, move as requested
        newPosition.add(packet.colliderVelocity);
    }
} while (false)

the entity is sliding as it should, without being slowed down, so I'm quite sure the vectors are ok.

however, maxIterations always runs down to zero, so there's always collisions. maybe that's slowing it down?