51

(19 replies, posted in Showcase)

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.

52

(13 replies, posted in General)

Another thing that happens to me is that threads are automatically set to "read" even when I've not actually read them. To avoid this I have to open a tab for every forum which has new posts and then read them one at a time, otherwise going back and forth will make all the "blue squares" disappear.
Maybe the board needs an update?

53

(15 replies, posted in General)

That's PC.

54

(15 replies, posted in General)

Tutorial Doctor wrote:

cpu screen.

What's that lol

55

(19 replies, posted in Showcase)

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.

56

(19 replies, posted in Showcase)

Reading the first post may help.

57

(19 replies, posted in Showcase)

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

58

(2 replies, posted in General)

Crucio777 wrote:

i can't find equivalent of functions of lua in c++

Sometimes they have different names or they may even not exist and you need to do 2 or 3 lines of C++ code to replicate them.
The cool thing is that you just need to refer to the MScript source file to see how the Lua functions are made:
http://code.google.com/p/maratis/source … .cpp?r=203
Just do a search with your browser and you'll end up to the function body that you need.
With minor modifications you should get a working code.
In the case of "translate":

MVector3 axis(1,0,0);
axis = object->getRotatedVector(axis);
object->setPosition(object->getPosition() + axis);

Reading other's code it's not ideal when you are still learning the basics.
Most of the time they use "advanced" syntax. It's better to start from square one, learning the basics, making some simple programs and then start learning object oriented programming applied to C++.
Only when you're done, you can read other's code and what you don't get you can examine in depth about.
I'm surprised you say there's no good tutorial. There is so much on the net that there must me something which fits you.
There are tutorials which assumes you already know certain things and there are others that starts from the very basics.

60

(8 replies, posted in General)

That's it, thank you big_smile

61

(8 replies, posted in General)

Nope, it doesn't solve it.

Generally, libraries could be released on the internet in this forms:
-a pack full of source files that you can directly compile
OR
-a DLL file (.dll) with a header file (.h) and an import library (.lib).

In the first case, you should create a C++ game plugin for Maratis and add the source files that you've downloaded in your project. Depending on various things you may get some warnings or even some errors during compilation and so it requires a bit of work to "adjust" the code to make it work or to add the necessary preprocessor directives.

In the second case, your source files will be the headers (.h), but the content of every function will not be in the source files but it will be inside the DLL (.dll) already compiled. So to compile you also need to include the import library (.lib) in your project.
Then your final executable (.exe) or, in this case, your Maratis plugin DLL (.dll), would have to run in the same folder of the DLL, so when you release your game you would have to release the DLL too.

The second case is the same scenario that you find when creating a Maratis plugin in C++: you have the Maratis headers and the MCore.lib and MEngine.lib import libraries.


The problem with the second case is that if the DLL (and the .lib) are compiled with say MinGW, it won't work if you compile your project with a different compiler, e.g. the Visual Studio one.


In any case you have to bother with C++, you can't use other DLLs with Lua.

63

(8 replies, posted in General)

I bring up this again because while changing the bounding box does work, I noticed that the entity is not immediately visible until the camera exits and re-enter the new bounding box. I'm wondering what I need to update to avoid this little glitch.

64

(15 replies, posted in General)

Tutorial Doctor wrote:

I think someone posted on this before, let me see if I can find it.

He requested this feature in the related thread.
There are no other threads about it.

65

(6 replies, posted in General)

Rig, constraints? You're overcomplicating things.
And complex path-finding is not necessary because the player is supposed to already be near the door. Otherwise you don't even trigger the "enter car event". Yes, "moveTowards()" is enough and I think it shouldn't be too difficult to do in Lua.
In pseudo-code would be:

if keyPressed(ENTER)
if isPlayerNearCarDoor
   then
      movePlayerTowardsPoint(CarDoor->getPosition())
      inAutoMotion = true;
endif
endif

if(inAutoMotion)
  if(playerPos ~= CarDoor->getPosition())
      inAutoMotion = false
      playAnimation(enterCarAnimation)
      playAnimation(DrivingPose)
  else
      //keep going towards point
      playerPos += directionVectorNormalized * howMuchPerStep
  endif
endif

66

(6 replies, posted in General)

Driving

You can make the character walk to the correct position, instead of snapping.
Then you rotate him in the correct direction, and then play the animation to enter the car.
So it will look all smooth.

67

(21 replies, posted in General)

I did it!

        MVector3 cross = A.crossProduct(B);
        if(A.dotProduct(cross) < 0)
            angle = -angle;
        offsetAxis = cross;
        offsetAxis.normalize();
        offsetAngle = float(angle * RAD_TO_DEG);

I did

if(B.dotProduct(cross) < 0)

That's wrong. To find the sign you have to do the dot product of Vn and the cross product, where Vn is the vector normal, which is basically the axis that you first used for reference.

I also did the cross product wrong. It is not commutative so you have to be careful if you do AXB or BXA.

68

(21 replies, posted in General)

Yes, reading the source file that you've posted I noticed RAD_TO_DEG.

the base of your code is ok

Nice to know. What I'm trying to do is explained here: http://forum.maratis3d.com/viewtopic.php?pid=5545#p5545
Since the mesh file may have a mesh a bit rotated (not perfectly looking towards one of the axis), I need to adjust that.
How can I do it?
1) rotating the mesh itself editing the vertices
or
2) adding a rotation offset to the bone associated with the ragdoll part (what I'm currently trying to do).

My code for finding the offset is now the following. It only runs one time, at the ragdoll creation, and saves the offset data in a class which manages the ragdoll part (the forearm in this case).

//find the angle between the elbow and the wrist bones (I've tried both local and relative coordinates)
    MVector3 AxisYPoint = elbowBonePos;
    AxisYPoint.y = 1000;
    MVector3 A = AxisYPoint - elbowBonePos;  //vector A
    MVector3 B = wristBonePos - elbowBonePos;               //vector B
    A.normalize();
    B.normalize();

//find the angle
    float dp = A.dotProduct(B);
    float angle = acos(dp);

//find the sign of the angle
    MVector3 cross = B.crossProduct(A);
    if(B.dotProduct(cross) < 0)
        angle = -angle;

    ragdollPart->angle = float(angle * RAD_TO_DEG);
//find the axis
    ragdollPart->axis = cross;

The code for moving the bone is the following one (the first part is basically the code you gave me in another topic):

            //rotate the bone
            MMatrix4x4 myMatrix = character_using_the_ragdoll->getMatrix()->getInverse() * (*ragdollPart->entity->getMatrix());
            MObject3d * parentBone = bone->getParent();
            if(parentBone)
            {    //calculate object matrix in parentBone's space coordinate
                myMatrix = parentBone->getMatrix()->getInverse() * myMatrix;
            }
            //get rotation coords from myMatrix
            bone->setEulerRotation(myMatrix.getEulerAngles());


            //add offset (that I calculated before)
            bone->addAxisAngleRotation(ragdollPart->offsetAxis,ragdollPart->offsetAngle);

There is a lot of code of course that I'm not showing, where I set the physics properties and do other things, but everything is working. If I don't do this "offset thing" all the ragdoll is working fine and the arm is swinging around the pivot and the skeleton is correctly updated, but the skeleton forearm is slightly off in respect to the ragdoll part forearm, and this is what I was trying to solve.

69

(21 replies, posted in General)

I've tried using local points but no luck.
What kind of values does setAxisAngleRotation() expects for the angle? e.g. float from 0 to 359
Just to know if I have the angle right.

70

(21 replies, posted in General)

zester wrote:

But regardless the info posted is still relevant.

Sure, I didn't get mad, I was just pointing out what you were not understanding. The lua-code-misinterpretation makes everything clear now. It's just hard to show our mood via forum text, but you can stay assured that my mood is always quiet and calm. big_smile

71

(21 replies, posted in General)

The code I've posted is not LUA, it's C++.

72

(21 replies, posted in General)

zester wrote:

You do know that when you start messing with the pivot point your bounding box for each object modified is going to change its scale and transformation right?

Not when you use the collision shape convex-hull.

You should more carefully read my posts BTW. You missed this important part:

start the physics context and enjoy how everything is working fine and the forearm swings

Which, in other words, means that my ragdoll code WORKS.
The problem is only when the mesh is a bit rotated (not facing the axis perfectly).
If I use a forearm mesh correctly rotated then my code does work. But I want my game to be able to accept and adapt to any meshes.

Normally you wouldn't even use a ragdoll in a game, they exist for...

You are again forcing me to say "I know my stuff". I can't write yet another wall of text just to explain all my project goals. This topic is just to ask specific help on a very specific task.

What you want doesn't have lua bindings yet "MArmature" and "MSkinData" I think "MSkinPoint * m_points;" is the  Bone's Transformation Matrice. If so thats what you would be wanting to tweek I do believe.
How is your C++?

Again, you have not read my posts carefully, since it's obvious that I'm using C++ and nothing else, with MArmature, MBones, etc.
This time you missed another line:

update the skeleton to match the rotation of the ragdoll part

73

(21 replies, posted in General)

zester wrote:

Ohhh and Mr I know my stuff

With "I know my stuff" I just meant that I know that you can change the origin in Blender but I really needed to change it via code. I just meant that, sorry if it sounded snob. Since you said "I am not sure I understand the logic behind..." I was just trying to say "yeah just trust me" lol.

zester wrote:

The problem with your code is your trying to rotate an object from a pivot point that doesn't exist. I know you think you created it but you didn't.

Thanks for the input.
But I think that the pivot does exist.
I'll try to give more information, I just didn't want the first post to be a wall of text, but I guess it's necessary.
What I'm trying to do is to create a complex ragdoll which loads a mesh as the bounding box for every part.
What I'm doing is this:

say you have a forearm and two bones, elbow and wrist
create a ragdoll part
set its origin the same as the wrist bone
set the part position in the position the same as the wrist bone
set the pivot constraint = position of elbow bone
update the skeleton to match the rotation of the ragdoll part
start the physics context and enjoy how everything is working fine and the forearm swings

but problem: if your ragdoll part mesh which is the forearm is a bit rotated (in the mesh file), then your skeleton will rotate wrong. This is why I'm trying to add an offset rotation to its rotation.
If you now look at the code in the first post, you will see that it makes more sense, given that point P is the elbow bone position and point Q is the wrist bone position.

An alternative is rotating the mesh itself, but this seems even harder because you have to change normals too, etc., but I may look into that too.

74

(21 replies, posted in General)

I appreciate your help attempts, but please now don't go off-topic. ^ ^

I know my stuff, I need to edit the mesh via code because I'm trying to do complex things and so the mesh must be manipulated by my game and not manually using Blender or other tools.
If you can find what's wrong in my above code, then post.
Thanks.

Still, I consider this not the expected behavior.
If you do a lua function "deleteEntity()" I'm sure you will delete all the associated physics objects, so the same should be with C++.
You can make MScene do this, while the MOEntity code shouldn't need to be touched. I think this would keep a good design/structure.