SoulSharer

Member
  • Content count

    40
  • Joined

  • Last visited

Community Reputation

270 Neutral

About SoulSharer

  • Rank
    Member
  1. How to instantiate classes in script?

    Not sure about this one. As far as I see, you could try registering it as a value type and use handles when needed? (But not as a POD, because it's not.)   According to http://www.angelcode.com/angelscript/sdk/docs/manual/doc_script_handle.html You can take a handle with "@", so: object obj; object@ obj_h = @obj; -5 means that it has invalid arguments asINVALID_ARG = -5, it must be that you can't register like that   But I'm no way a guru in this thing, so don't follow my thoughts directly.
  2. How to instantiate classes in script?

    Hello :), I guess you could benefit from reading http://www.angelcode.com/angelscript/sdk/docs/manual/doc_reg_basicref.html So if you want to create an instance in script you will need to register a factory function (it could be as easy as new Class()). You might also missing reference counter, unless you want to handle all this yourself.   As far as language goes, there is no * or -> in there. So its a dot operator for everything. But you should really read some docs, it will benefit you in a long run.   http://www.angelcode.com/angelscript/sdk/docs/manual/index.html
  3. [AngelScript 2.26.3] Global property issues [Solved]

      Thanks again, as a suggestion I would add set property methods, so it will be more clear and maybe a little less error prone? But anyway great stuff. :)
  4. [AngelScript 2.26.3] Global property issues [Solved]

    Problem #1 - Solution   I've got the answer on the first problem, thanks to Andreas, so I will post it here in case someone will face the same thing.     Now it makes perfect sense. Still not sure about problem #2 though. If I solved it right or is there another way which I didn't notice?
  5. [AngelScript 2.26.3] Global property issues [Solved]

    Problem #2 - continuation   Object declarations are now added to the script source code before the compilation. And to initialize a variable I found out that I can get a pointer to a variable and it seems to work, but hell, it looks like a hack that asks for trouble, is it intended use? int index = mod->GetGlobalVarIndexByName("topCloth"); GraphicsObject** adr = ((GraphicsObject**)mod->GetAddressOfGlobalVar(index)); *adr = (GraphicsObject*)(topClothObject);
  6. [AngelScript 2.26.3] Global property issues [Solved]

    Oops, I'm sorry, it is in fact version 2.26.3 and I cant change the name of the topic. Fixed, need to open full editor to change the name of the topic.
  7. Hello friends, I'm working on a game that requires intensive scripting (adventure game) and I experience some difficulties dealing with global properties. It would be great if someone could help a fellow indie developer. Thanks.   Problem #1 (Solved - see below)   The problem is that in the example provided here: documentation link, we see that: // Variables that should be accessible through the script. CObject *g_object = 0; // A function to register the global properties. void RegisterProperties(asIScriptEngine *engine) { // Register variable where the script can store a handle to a CObject type. // Assumes that the CObject type has been registered with the engine already as a reference type. r = engine->RegisterGlobalProperty("CObject @g_object", &g_object); assert( r >= 0 ); } However it doesn't seem to work for me . I do it like this: int r = 0; GraphicsObject* go = ((GraphicsObject*)GetEntity("mooseCloth")); r = engine->RegisterGlobalProperty("GraphicsObject @mooseCloth", &go); SE_ASSERT( r >= 0 ); go = ((GraphicsObject*)GetEntity("topCloth")); r = engine->RegisterGlobalProperty("GraphicsObject @topCloth", &go); SE_ASSERT( r >= 0 ); go = ((GraphicsObject*)GetEntity("mooseHead")); r = engine->RegisterGlobalProperty("GraphicsObject @mooseHead", &go); SE_ASSERT( r >= 0 ); Everything compiles without errors, but when I access this objects from script all of them point to the latest declaration "mooseHead". So for example if I go topCloth.DoStuff(); instead of accessing topCloth it interferes with mooseHead.  What am I doing wrong here?   One thing though, getting rid of this "@" for script variable declaration and "&" for passing the pointer to the object seems to solve that problem. But I'm not sure if it is a good way to go and if there any pitfall involved?     Problem #2 (Solved, see Andreas answer)   I want to declare a variable in a scope of module, so that when the game scene gets destroyed all the global variables are destroyed with it. However I didn't find a way to do that. There is a thing  CompileGlobalVar() but it doesn't allow me to pass the pointer to an object and there is no other function to do so (as far as I see), so I'm confused at that point.  There is no ability to destroy/unregister a global variable in the asIScriptEngine as well.   Thanks. Yaroslav.
  8. Trying to make my skeletal animation to work I came into the state of confusion and misunderstanding. I know that this topic is not new and there are plenty of those everywhere, yet they don't answer some of my questions or sometimes they bring even more confusion. I'm sorry about starting a new though, I hope you understand. I'm working on CPU skinning and using Direct3D10 with C++ I know how skinning works, you create a mesh in 3ds max (for example) then u create bones hierarchy and assign vertices to the bones with weight (which contains influence value). Vertex may have more than one weight. Knowing that I export skeletal hierarchy with custom plugin from 3ds max, then I export vertices with associated weight, however I'm not sure how to export bone's (joint's) orientation (quaternion) and translation (vector3) and how to use them in the game. (then I might need a scale as well I guess) All I know is that I should export bones with local space tranformation and then in the game I must multiply them by parent bones with influence (from weight) to get a World tranformation for the bone. Then I use this world tranformation to move vertices. But some resources say I must also export bind pose and somehow multiply my bones tranformation by inverse transformation of this bind pose. So this is what makes me confused, what should I do? 1. What do I need to export from 3ds max in order to get my skeletal animation working? 2. Do I need to export local tranformations of each bone? 3. Do I need to export bind pose? And if so, how would I use it? 4. How would I calculate world matricies of the bones? (in order to use them on my verticies) So if you could help I would really appreciate that. Thanks!
  9. Hello there, I wonder if someone could help with this subject. I want to create a model in 3Ds Max and a collision mesh (made of primitives, ie boxes and spheres) that will accompany it. And then export it so that PhysX will use collision mesh to create an actor. How would I decompose and make this PhysX Actor from a primitives? Thanks in advance! I want to replace PxConvexMesh/PxTriangleMesh with this primitives, so it will increase overall performance of PhysX. This video shows what I'm looking for: http://www.youtube.com/watch?v=rdcGe9PPyao
  10. Input for a windows game

    Thanks for the help guys. I have very last question do I need to make a class that will be filled from WM_INPUT event (each time it's called)? Or do I need to get input in game loop itself somehow (maybe with some function) and feed it into input class I'll make? And won't feeding from WM_INPUT make a glitch in the whole input system? I mean maybe there are delays between event calls. [quote name='ApochPiQ' timestamp='1332129300' post='4923190'] [url="http://www.gamedev.net/blog/355/entry-2250186-designing-a-robust-input-handling-system-for-games/"]Required reading[/url]. [/quote] Good article, its very useful, yet you are using WM_KEYUP / WM_KEYDOWN in the source code. =(
  11. Hello there. I'm currently trying to figure out how to properly use Raw Input and I'm just a bit confused. Well, previously I worked with DirectInput, but its deprecated and Microsoft advises not to use this one for mouse and keyboard. So thats why I'm switching to Raw Input. [i]I want to implement the same approach used in [/i][b]XNA[/b] [code] KeyboardState keyState = Keyboard.GetState(); if (keyState.IsKeyDown(Keys.Q)) { //do something on keydown } MouseState mouseState = Mouse.GetState(); if (mouseState.LeftButton == ButtonState.Pressed) { //do something on left mouse button pressed //you can get coordinates of the mouse as mouseState.X and mouseState.Y } [/code]Is there any way to implement the same concept with [b]Raw Input[/b]? And how would I implement that? Link, search suggestion or a book name will be more than enough. I appreciate your help. Thanks!
  12. ShaoLeaf [iOS]

    -
  13. ShaoLeaf [iOS]

    -