Topic: Visual 3D Math

Draw points and vectors within your game plugin.
I've made it when trying to understand something about vectors, matrices and quaternions, I thought I could share.
Maybe I'll add other things (e.g. drawAngle), but definitely not soon tongue

Download (put the meshes in your "meshs" folder or change the path in the source code):
https://app.box.com/s/7mnjfiu0ukdyw0jx4fkc

Example code:

    Point* p1 = new Point(MVector3(4,4,0));
    Vector* v1 = new Vector(MVector3(1,1,1));
    v1->setVisualOrigin(p1->getPoint());
    v1->setVisualLength(5.0f);
    v1->showComponents(true);

http://oi40.tinypic.com/2qjvuck.jpg

Re: Visual 3D Math

Im curious as to what this does. Do I need to know C++ stuff?

Re: Visual 3D Math

Reading the first post may help.

Re: Visual 3D Math

Speaking of plugins, was this ever resolved, as in can we now have multiple plugins ? That is mandatory to do any serious game, right ?

Also, unless the info is contained in your archive, I doubt TD is going to know much about the subject matter involved, as I wouldn't either. He barely programs in lua as do I (  adequately ), and c++ is a leap of faith at this juncture, if you get my drift <harhar> tongue

To be great at programming, or so I hear, takes 10 years and I think those that are already there, sometimes forget that .

cu
VD

Re: Visual 3D Math

This "plugin" of mine (it's actually an addition to a C++ plugin given in the form of source files) allows you to draw points and vectors in your scene so that you can visually see them instead of operating just with numbers.
This is useful when debugging: let's say you want to calculate a direction vector to move a character along it.
It doesn't work as expected, so you use my plugin to visually see where this vector is pointing to help you understand what is possibily going wrong (e.g. it's pointing in the inverse direction or 90° wrong, I don't know).

However, the first sentence alone in my first post answers both Tutorial Doctor's questions ("what is this about" and "do I need C++").
But I also added:
a code example
and
an image
You may not be able to use it, but you can't say that you don't get what this is about.
As you don't know C++, I don't know Lua. But this doesn't justify negligently (superficially) reading a post. And you're good at it too lol as we've seen in the other thread of mine. I'm not trying to be a moron but come on, read my first post and then read Tutorial Doctor's question: it feels like a joke (I know it was not meant to); it's like this:
«Hey there I've made a recipe to make a cake.»
«What's this about? Do I need a kitchen?»
You may not be good at cooking, but this doesn't justify your question.

BTW please let's quit this and go on with other discussion topics like the other question of yours:

VeganDev wrote:

Speaking of plugins, was this ever resolved, as in can we now have multiple plugins ? That is mandatory to do any serious game, right ?

It depends. In the case of this plugin of mine, you can easily add it to your plugin code and just doing:

#include "Visual3DMath.h"

allows you to use its functionalities.
If you do more complex plugin, which for example does something every frame, like moving an entity, then yes, you should need more plugins.
You'll end up with more DLL files but it's not a big deal.
However since all the plugins edit the same MGame class there could be incompatibilities.
So I'm not sure how doable it is to have more DLL.

Re: Visual 3D Math

I think part of my post got cut off. I had asked (originally) how would I go about using it (the reason i asked if I need to know c++ to use it.)

It could be just drag and drop, in that case I wouldn't need to know c++ to use it.
And your latter post clarifies better (for noob programmers like me) how this could be useful to me.

Thanks.

P.s I have been having this post cut off thing happen lately, and the only way I find out is if I go back and read it.

Re: Visual 3D Math

255 wrote:

This "plugin" of mine (it's actually an addition to a C++ plugin given in the form of source files) allows you to draw points and vectors in your scene so that you can visually see them instead of operating just with numbers.
This is useful when debugging: let's say you want to calculate a direction vector to move a character along it.
It doesn't work as expected, so you use my plugin to visually see where this vector is pointing to help you understand what is possibily going wrong (e.g. it's pointing in the inverse direction or 90° wrong, I don't know).

However, the first sentence alone in my first post answers both Tutorial Doctor's questions ("what is this about" and "do I need C++").
But I also added:
a code example
and
an image
You may not be able to use it, but you can't say that you don't get what this is about.
As you don't know C++, I don't know Lua. But this doesn't justify negligently (superficially) reading a post. And you're good at it too lol as we've seen in the other thread of mine. I'm not trying to be a moron but come on, read my first post and then read Tutorial Doctor's question: it feels like a joke (I know it was not meant to); it's like this:
«Hey there I've made a recipe to make a cake.»
«What's this about? Do I need a kitchen?»
You may not be good at cooking, but this doesn't justify your question.

BTW please let's quit this and go on with other discussion topics like the other question of yours:

VeganDev wrote:

Speaking of plugins, was this ever resolved, as in can we now have multiple plugins ? That is mandatory to do any serious game, right ?

It depends. In the case of this plugin of mine, you can easily add it to your plugin code and just doing:

#include "Visual3DMath.h"

allows you to use its functionalities.
If you do more complex plugin, which for example does something every frame, like moving an entity, then yes, you should need more plugins.
You'll end up with more DLL files but it's not a big deal.
However since all the plugins edit the same MGame class there could be incompatibilities.
So I'm not sure how doable it is to have more DLL.

You know what, just  because you are a 'almighty' programmer, doesn't allow you to be RUDE. You are clearly NOT from Missouri.

You are flat, rude.

YOu are lucky anael is who he is, or you would be REMOVED from this forum. I still think you should be. You need a RUDE awakening, to the fact, that you are human, Im human, TD is human, and you don't 'get away' with talking DOWN to people .

What about that, is difficult for you, to grasp ? YOu are one to say, 'ah come on', so Im asking you, --really, come on now! wink

I guess your blinding intellect, blinds you to the finer points of accommodating other peoples FEELINGS. We aren't robots with no feelings, but even so, if we were and were more like the 'doctor' on voyager then we'd still be feeling the marks of your stinging comments.

I also see you replied with more detail, and that's just lovely of you, but I've no interested in reading it, as I could not get beyond your arrogant attitude, long enough to concentrate on your response.  If I saw an apology, I could prob. do it though wink I see a lot of people making seriously mean  comments, and not offering apologies afterwards. There seems to be a trend going on around here lately....Is this what it means to be a programmer ? To be mean, and disprectful to other peoples feelings ? Count me OUT if that's what all this means ;)haha.

Just, Wow.

There are consequences in life, usually, for  arrogance such as yours, but I guess around here that might not apply.

'can't we all just get along', isn't going to work really well, when someone is willing to throw out nasty bombs. Just sayin...

If you are having posts cut off TD, you might need to switch to using IE browser as a experiment ?, My friends were having similar issues with firefox ( and other things) which caused him to switch to IE as well. good luck!

And btw, before anyone presumes Im ANGRY or going on and on, this is not the case. Just ask my local friends , when they get in their arrogant little 'moods', and then ask them what happens :)hahaha. I hold THEM accountable, and fire right back at them, so they know they did wrong. This doesn't mean Im not vulernable to not being rude at times, as we all have faults and try hard to 'overcome' them, but in the part of the world IM FROM, we apologize afterwards for rudeness.

If I've ever been rude to someone, and it wasn't called for specificially by their actions, then I apologize right now in advance. Stuff happens, but apologies SHOULD be offered always. ;)heh

Last edited by VeganDev (2013-10-22 18:18:43)

Re: Visual 3D Math

VeganDev wrote:

YOu are lucky anael is who he is, or you would be REMOVED from this forum. I still think you should be.

I think anael should remove from the forum people who acts like kids and are not able to use an internet board without getting all upset and offended for every post others write. If I wanted to talk about humanity and emotions I would visit a different forum, here I guess we should stay pretty technical.
Maybe you need more real human-interactions?
Tutorial Doctor "solved" the matter very easily without getting into this crazy wall of text lamentations, you should learn from him.
(Now, THIS is rude, and it's the first actual rude thing I've wrote in the entire forum. But you definitely asked for it lol.)

About this almighty programmer myth, I am not, I just do it for hobby every now and then and I mostrly suck at it (it takes me hours to get things done that a real programmer could do in minutes).

BTW about this sentence of mine

And you're good at it too lol as we've seen in the other thread of mine.

I confused you with zester, referring to an other thread. There are a lot of misunderstanding ultimately uh..
So sorry for that, especially if that is what made you get mad.

Re: Visual 3D Math

OH poor 255. I wasn't 'mad', I was responding to your hate post. That's how we 'learn'.
YOu responded to poor TD and me , in angry form.   Putting us down as if we are 'beneath' you somehow.

Maybe you don't realize it, but you do it. Now you r ealize that you do it, and then you further try to put me down, to avoid taking responsibility yourself. Do you think that's nice ?

YOu attempt to put me down, say I 'overreacted somehow and should learn from others 'posts', yet you do this :

"  (Now, THIS is rude, and it's the first actual rude thing I've wrote in the entire forum. But you definitely asked for it lol.)   "

So please enlighten me would you, how you find it inyourself, to blame others for not being attentive enough to reasonable conversation, then further insult and ridicule, by seeming to enjoy that THIS is really going to be rude , and laughing about it, because I surely, 'asked for it' lol.

And you call me out of touch ?

I accept your apology btw, which YES, was a big part of what caused me to scold you, and show you the error of your ways. That's  what being  a responsible citizen is all about, showing others , that when they 'bully' other people, they will be called OUT for it. Maybe in your world, that never happens, but sorry, I call people out , when they do it, as society should do, otherwise bullies just  continue to bully.

Anyway , apology accepted, I think (  not that Im at all sure you meant it, give you attitude overall, but w'ell see how things go)

Last edited by VeganDev (2013-10-22 18:53:25)

10

Re: Visual 3D Math

Mine wasn't a hate post and I didn't respond in angry form (before). And yes, you got mad. Saying the contrary doesn't make your post any different from an "upset post".
«WE ARE HUMAN!» and stuff like this.
Well, whatever, maybe we both don't understand the nature of our posts.
I think my post was not angry and that your was angry.
You think that my post was angry and that your was not angry.
lol
Well at least we know that now.

p.s. all this because of this cutting-posts-forum-bug? Oh jeez big_smile

Re: Visual 3D Math

YOu owe me another apology for this :

"  YOu attempt to put me down, say I 'overreacted somehow and should learn from others 'posts', yet you do this :

"  (Now, THIS is rude, and it's the first actual rude thing I've wrote in the entire forum. But you definitely asked for it lol.)   "
"

Can't you just apologize to someone, without asking something in return, in this case, by specifically saying you are going to ENJOY the following put down, and then lol about it.

You said I was the angry one, well I do sometimes get angry at willful insults, but it seems you enjoy insulting people.

I wonder who here needs therapy, the one  who enjoys insults, or the one who   feels responsible for showing people the error/arrogance/hatefulness of their ways, to try to stop them from bullying others. YOu do know, the current trend in bullying is causing suicides, right ? Just sayin...sometimes there are horrible consequences for the actions, that we think at the time, mean nothing to us, but are devastating to someone else wink ( not me).

" Well, whatever, maybe we both don't understand the nature of our posts.
I think my post was not angry and that your was angry.
You think that my post was angry and that your was not angry.
lol
Well at least we know that now. "

That's not a apology, its you just trying to get out of the mess you put yourself in, when you said I had it coming and that THIS was going to be rude.

Maybe its a 'language barrier', I honestly don't know. I know rude when I see it,,OR maybe you're not presenting yourself favorably given English isn't your first language.

That could very very easily be the case.

So lets' start ALL over.

Let's not ever, be rude again, to anyone asking for help, not in any way shape or form, shall we be rude, condescending or   show angst over them asking coding questions, and if you can't help yourself, instead of doing it, just point TD/us/me to a URL where we can understand the finer points of what you are trying to say wink

Problem solved ya us! wink)

Sorry for any misunderstands 255, can we now start over ? wink)

Last edited by VeganDev (2013-10-22 19:01:48)

Re: Visual 3D Math

Wow, this is going on all over the place (tempers people tempers!) haha.

This gizmo will seems to be very useful though once I figure out how to implement it (learning about vectors in 3d myself).

It is good to have a visual representation of what is happening in code, and that gives me a good idea. Thanks 255.

Re: Visual 3D Math

255 wrote:

Mine wasn't a hate post and I didn't respond in angry form (before). And yes, you got mad. Saying the contrary doesn't make your post any different from an "upset post".
«WE ARE HUMAN!» and stuff like this.
Well, whatever, maybe we both don't understand the nature of our posts.
I think my post was not angry and that your was angry.
You think that my post was angry and that your was not angry.
lol
Well at least we know that now.

p.s. all this because of this cutting-posts-forum-bug? Oh jeez big_smile

Don't pay any attention to him 255, he is trying to do the same to me. Just make fun of him or ignore him all together, maybe he will go away.

Re: Visual 3D Math

SO this entire thing, was to make a point about creating a gizmo ?

I presumed it was literally about , points and vectors, because he said nothing, even though I agree it DOES look like a gizmo which maraits uses, about being a gizmo. I try not to assume anyting.

15

Re: Visual 3D Math

VeganDev wrote:

just point TD/us/me to a URL where we can understand the finer points of what you are trying to say wink
Problem solved ya us! wink)

I understand your point, I'll try to do that in the future.

Tutorial Doctor wrote:

This gizmo will seems to be very useful though once I figure out how to implement it (learning about vectors in 3d myself).
It is good to have a visual representation of what is happening in code, and that gives me a good idea. Thanks 255.

Thank you Tutorial Doctor for trying to bring the thread in-topic. I may see if I can translate this into a Lua list of functions maybe. Shouldn't be too hard I guess.
Maybe doing a class derived from MScript and adding some methods?
Has anyone done something like this (extend lua functions)? What's the "standard way" to go?

Last edited by 255 (2013-10-22 19:11:14)

Re: Visual 3D Math

zester wrote:
255 wrote:

Mine wasn't a hate post and I didn't respond in angry form (before). And yes, you got mad. Saying the contrary doesn't make your post any different from an "upset post".
«WE ARE HUMAN!» and stuff like this.
Well, whatever, maybe we both don't understand the nature of our posts.
I think my post was not angry and that your was angry.
You think that my post was angry and that your was not angry.
lol
Well at least we know that now.

p.s. all this because of this cutting-posts-forum-bug? Oh jeez big_smile

Don't pay any attention to him 255, he is trying to do the same to me. Just make fun of him or ignore him all together, maybe he will go away.

I was trying to help him understand what occurred, and you come here attacking me too ?

What about 'not nice' , do you not understand. You seem to enjoy' making fun of others', yet you call ME out for causing trouble ? Really zester, what part of hypocrisy is lost on you ?

I tried to spin this thread DOWN, by apologizing, and 'guessing' why things spiraled out of control, then you zester come here with your mental aerobics, and cause MORE trouble.

Really zester , was there no other post you could have made, and not continue the downward spiral ? I had stopped 'the bleeding' if that's an analogy you prefer, and you just opened up a huge chasm.

Last edited by VeganDev (2013-10-22 19:29:38)

Re: Visual 3D Math

255: You don't need to extend MScript. Just use the following in your 'StartPlugin' function:

MScriptContext* script = engine->getScriptContext();
script->addFunction("applyDamage", applyDamage); // applyDamage is the pointer to a function returning an integer

a simple function for use looks like this:

int applyDamage()
{
    MEngine* engine = MEngine::getInstance();
    MGame* game = engine->getGame();
    MScene* scene = engine->getLevel()->getCurrentScene();
    MScriptContext* script = engine->getScriptContext();

    if(script->getArgsNumber() != 2)
        return 0;

    int firstInteger = script->getInteger(0); // The first argument of the call
    int secondInteger = script->getInteger(1); // The second argument of the call
        
    return 1;
}

Have fun, Sponk

18

Re: Visual 3D Math

Perfect, that's simple and comfortable.
Thanks.

Re: Visual 3D Math

this is very useful and easy to use thank you 255 smile .
Are you gonna add anything to the plugin in the future ? .

20

Re: Visual 3D Math

255 wrote:

Maybe I'll add other things (e.g. drawAngle), but definitely not soon tongue

Basically, if I'll need something during my game development process, I'll add it. ^ ^