Jump to content

Shard

Members
  • Posts

    293
  • Joined

  • Last visited

Posts posted by Shard

  1. For our trigger system I have created a fairly straight forward method.

     

    A trigger object hold all the values that we need, like speech, music, scripts, etc.

     

    I set the collision callback and when I collide it goes off successfully and correctly.

     

    However the player is still colliding with it, causing it to go off again. And again. And again.

     

    So I figured that I would free the collision body so that collision callback wouldn't occur.

     

    This leads to a new problem: the collision callback still occurs but all GetEntityUserData returns garbage and the trigger still tries to activate with garbage data resulting in an error.

     

     

    How do I stop collision callback once I'm done with it?

     

     

    //Trigger

    struct Trigger
    {
    TVec3 pos;
    TSound music;
    TSound *speech;
    string scene;
    
    TBody body;
    
    static Level *level;
    
    int usable;
    
    int characterLoadID;
    
    Trigger()
    {
    	this->music = NULL;
    	this->speech = NULL;
    	usable = 1;
    }
    };
    

     

     

    //Init

    	Trigger *trigger = new Trigger;
    trigger->pos = objectPosition;
    
    //Music
    if(music != "")
    {
    	music = "abstract::" + music;
    	//trigger->music = new TSound;
    	//(*trigger->music) = LoadSound(str(music.c_str()));
    	trigger->music = LoadSound(str(music.c_str()));
    }
    
    //Body
    TVec6 box = GetEntityAABB(entity);
    float depth = box.Z1 - box.Z0;
    float height = box.Y1 - box.Y0;
    float width = box.X1 - box.X0;
    
    trigger->body = CreateBodyBox(width,height,depth);
    PositionEntity(trigger->body,objectPosition);
    RotateEntity(trigger->body,objectRotation);
    EntityType(trigger->body,4);
    
    SetEntityUserData(trigger->body,(byte*)trigger); //Data type to trigger
    SetEntityCallback(trigger->body,(byte*)TriggerCollision,ENTITYCALLBACK_COLLISION); //Collision callback function
    trigger->level = this->level;
    

     

     

     

    //Collision Callback

    void _stdcall TriggerCollision( TEntity triggerBody, TEntity entity, byte* position, byte* normal, byte* force, flt speed ) 
    {
    if(GetEntityType(entity) == 1)
    {
    	Trigger *trigger = (Trigger*) GetEntityUserData(triggerBody);
    	trigger->level->ActivateTrigger(*trigger);
    }
    }

     

     

     

    //Level::ActivateTrigger

    void Level::ActivateTrigger(Trigger &trigger)
    {
    if(trigger.usable > 0)
    {
    	if(trigger.music != NULL) PlaySound(trigger.music); //Music
    
    	HideEntity(trigger.body); //Not working
    	FreeEntity(trigger.body); //Not working
    
    	trigger.usable--; 
    }
    
    
    }

     

    Also, this thread should probably be moved to the C++ forums. >,>

  2. Hi Shard,

    As I understand.. Daz has a new Eula which allows purchasing of a licence for Poser Characters for game use. They have developed a kit which reduces poly count and changes the quad polys to tris and makes multiple maps into a single one. It also includes an .FBX exporter. Havn't tried it but have seen videos of Poser Characters animated in Unity. Look ok too at around 5000 to 10000 ks. The only issue I can see is that Leadwerks doesn't support Morphs (Please change this Josh).

     

    Whats a morph?

  3. For our reloading animation, I need it to reload once per call, which means that it needs to play from its start frame of 0 to its end frame of 100 and then stop until the reload animation is called again.

     

    So far, I haven't managed to figure out how to properly do the reload animation so that it starts and stops at the correct times.

     

    The code I have below usually stops the animation at the right time, but sometimes it does it three or four times over before it stops. The animation also generally starts in the middle, around 30 or 40 and sometimes near the end like 95.

     

    //Animation Code - Reloading Case

    
    case reload:
    	aniStart = weapon->reloadStart;
    	aniEnd = weapon->reloadEnd;
    
    	//DOF
    	frameWork->GetRenderer().SetFarDOFRange(Vec2(0,50));
    	frameWork->GetRenderer().SetFarDOFStrength(200);
    	frameWork->GetRenderer().SetFarDOF( true );
    
    	frame=AppTime()/30.0;
    
    	frame=fmodf(frame,aniEnd-aniStart)+aniStart; 
    
    	if(frame <= aniEnd-1)	
    	{
    		(bodyMesh,frame,1.0,0,true);
    	}
    
                  else wepState = idleUp;
                  break;
    }
    
    

  4. I'm looking into purchasing a 3D Character generation software (with animation) and I'm wondering how well LE supports these softwares.

     

    Of course these softwares can output into multiple formats that can then be converted into gmf's but I know that our team has had problems with the way a model is skinned, etc.

     

    Also, I tried to export an obj into a gmf, but the program disappeared (the process was still running but it just took up massive amounts of CPU time and did nothing, I had to end the process)

     

     

    If someone could explain this quickly, as Smith Micro is having a deal on Poser till the 31st of this month (half price, $250 instead of $500) I would be rather grateful.

     

     

    Edit: Has anyone had experience with such software? Would you recommend one over the others?

  5. Unless you post a program that demonstrates the problem, we're all just speculating about what the problem might be.

     

     

    We'll work on this.

     

     

    Done.

     

     

    Please note that I didn't include the solution files because I'm using VS2010 and I was unsure if you were using 2010. I have however included the the Main.cpp

    Also, please note that the movement and camera controls are inverted. This is due to a bug in our art and no related to the disappearing model problem.

     

    (Upload to LE failed twice): http://www.3rdinitiative.com/system/content/LE_Bug.zip

  6. Did you notice that? Do you think that's the problem too?

     

    This is a good possibility, but how did you fix it?

     

     

     

    1. Maybe your model is not centered in your modeling app. I've seen this behavior before when I used models that are not centered, the engine/camera sometimes thinks the model is out of view when it's not.

     

    2. If not, you could try a workaround of creating a transparent bounding box. (not a very elegant solution though)

     

    -- Edit:

    Your model is probably animated by the looks of it. It could also be the engine is just taking 1 frame of this animation into account, if in this frame the arms are down for instance, they might not show because the model is not in view during that single frame.

     

     

    1. Possibility, I'll look into it.

    2. How?

    3. No, everything is visible in all the frames. It only disappears when its up too close.

  7. So I have a (large) problem with Leadwerks 2.31 and 2.32.

     

    We have a player model, with arms and a gun and armor.

     

    Unfortunately when I parent the camera to head and play the game, the gun doesn't show up.

     

    So I did several tests to see if the gun would show up and it seems to show up if the camera is further away, but in some screenshots it doesn't show it when looking at specific places (generally at the horizon). The same goes for the armor, which seems to disappear and appear as I look around.

     

    This issue came up with the update to Leadwerks 2.31 but at the time, I thought I was doing something wrong in code. After having gone back and tested all posibilities (with 2.3, 2.31 and 2.32) I firmly believe that its an issue with 2.32.

     

    Has anyone had this issue? How have you solved it? How do I solve it?

     

    Help?

     

     

    //Init Code

    	EntityParent(bodyMesh,frameWork->GetMain().GetCamera());
    RotateEntity(this->bodyMesh, Vec3(0,180,0));
    
    TVec3 pos = EntityPosition(body);
    pos.X -= .125;
    pos.Y -= 2.125;
    pos.Z += .5;
    
    PositionEntity(bodyMesh,pos);

     

     

    //Update Code

    	//Rotate camera
    camRotation.X = Clamp(camRotation.X + controller->GetViewY()/10, -90,60);
    camRotation.Y = camRotation.Y - controller->GetViewX()/10;
    RotateEntity(frameWork->GetMain().GetCamera(),camRotation);
    
    
    //Reset Mouse Position
    MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2);
    
    
    float move = controller->Move();
    float runSpeed = controller->Run();
    
    //if(move > 0 && player->state != reload) move *= controller->Run();
    
    
    //Update Player
    UpdateController(player->body,camRotation.Y,move*10,(controller->Strafe())*10,
    	controller->Jump()*player->jumpHeight,
    	10000,
    	20);
    
    
    
    //Position the camera 
    playerPos = EntityPosition(player->body);
    cameraPos = EntityPosition(frameWork->GetMain().GetCamera());
    
    cameraPos = Vec3(playerPos.X,cameraPos.Y,playerPos.Z); 
    cameraPos.Y = Curve(playerPos.Y+1.75,cameraPos.Y,2.0);
    
    PositionEntity(frameWork->GetMain().GetCamera(),cameraPos); 

    post-26-12749092482445_thumb.jpg

    post-26-12749092492811_thumb.jpg

    post-26-12749092501768_thumb.jpg

    post-26-12749092510241_thumb.jpg

  8. That's exactly the same as writing

     

     

    if(0 >= AppSpeed()*60)
    {

     

    And that's almost always going to be false. It will only be true when AppSpeed() returns 0 (since 0 * 60 = 0).

     

     

     

    Thats kinda the point. You want this piece of code to only run once a second, there for running as the same time as all the other copies of the game on other computers. The engine is created so that the AppTime is done at a specific speed across all computers, which is one second per second.

     

    My code will increment until reaches the one second mark which will be a result of AppSpeed * 60. Again if your monitor refresh rate is that high, the AppSpeed value is higher until it matches one second.

  9. Or conversely maybe Josh could fix it and update the 2.32 download ... hows that for a radical thought :D

     

    After all this has been pointed out many times before!

     

    Failing that, if the functionality is simply un-useable due to the physics issue it would be better removed. People will continue to try to use it so long as it’s present.

     

     

    As stated before, I don't need scaling of physics, just the mesh itself which I will parse in code, so that method works. For now.

  10. I think when you want to render picture to picture, you render the scene to a buffer and paste this on a 2 surface created by hand.

     

    As for the extra window: I think this might be a problem with the EULA. Since you are not 'entirely' allowed to mkae your own editor/program with it. I have read something about that.

     

    Are you sure about that? Pixel has created an AStar tool with Leadwerks.

  11. Flip(1);

     

     

    Flip simply flips the back buffer to the front buffer, effectively drawing all of the frame's updates to the window/screen. It must be included in the program loop every frame.

    Flip(0) - Won't use VSync so the framerate won't be limited by the monitor refresh rate. Make sure you use AppSpeed in all of your time dependent values such as movement, and you should use UpdateWorld(AppSpeed()) as well.

    Flip(1) - Uses VSync to make sure the buffer is flipped at the same frequency as your monitor's refresh rate.

    Flip(-1) - Uncaps the buffer update rate.

     

    According to the wiki, Flip(1) just makes it refresh at the rate of the computer screen. What happens when someones monitor refreshes faster than others? And god forbid someone is playing on a 3D capable monitor at 120Hz

     

     

    I would personally suggest doing something like this:

    int value = 0;
    
    if(value >= AppSpeed()*60) 
    {
       //Do Stuff
    
       value = 0;
    }
    
    else value++;

     

    AppSpeed checks the refresh rate and returns a normalized value. So if the refresh rate is 120, it will return 0.5 if its 30 it will return 2. When multiplied by a multiple of 60 (one second) you get that many seconds. So if you want a refresh rate of every 2 seconds, do AppSpeed()*120;

  12. What did google say about theora c++ library downloads then? I didn't check, but I would assume you need need to download theora to use theora, since it's not part of microsoft sdk. ;)

     

     

    Well I was told to download Theora and I did. I placed it in the Leadwerks SDK Folder and included them. Now I get this warning:

    warning C4251: 'TheoraVideoClip::mName' : class 'std::basic_string<_Elem,_Traits,_Ax>' needs to have dll-interface to be used by clients of class 'TheoraVideoClip'
    1>          with
    1>          [
    1>              _Elem=char,
    1>              _Traits=std::char_traits<char>,
    1>              _Ax=std::allocator<char>
    1>          ]

     

     

    Also, in LETheora.cpp, it can't locate

    #include "lua.h"
    #include "lualib.h"
    #include "lauxlib.h"

     

    Also, how am I supposed to link things non statically anyways?

     

    Could someone just explain the process of linking the library?

  13. Ok so now my code has broken.

     

    I had several pointers all over my code to Framewerk so that all the different classes could access it.

     

    I changed all my Framewerk variables to Framework variables and I get several errors.

     

    Compile Error

    >d:\source code control\appiled project\current version\zero hour\zero hour\hud.cpp(66): error C2228: left of '.SetFarDOFStrength' must have class/struct/union
    1>d:\source code control\appiled project\current version\zero hour\zero hour\hud.cpp(68): error C2227: left of '->GetRenderer' must point to class/struct/union/generic type
    1>          type is 'TFramework *'

     

    VS2010 Underlining Error Message

     Error: expression must have pointer to class type

     

     

     

    My usage is as below

     

    Main.cpp

    Framework *frameWork = new Framework;
    frameWork->Create();
    frameWork->SetStats(2);

     

    Hud.h

    TFramework *frameWerk; //this is set to point to the frameWork variable initialized in main

     

    Hud.cpp

    frameWork->GetRenderer().SetNearDOFStrength(.7);

     

     

    With our project being this close to the due date, I might just have to revert to 2.31 which is a shame since I was expecting to do so much out of 2.23.

  14. So when were we given notice that framewerk was going to be dropped?

     

    We weren't. We were informed ex post facto. In the 2.23 release thread and the update log file.

     

    However, it seems that it hasn't been dropped but rather integrated into the core engine itself.

  15. So what happened to Framewerk? I had several Framewerk pointers all over my code because several different classes needed access to it but its now gone. I think I read somewhere that it has been integrated with the engine. How do I access it now?

     

    Edit: The log says that Framewerk has been integrated with the engine but not how to access it.

  16. Cannot you do the inverse? That is: add a Level variable and an Activate method in the Trigger class and then if you can call an ActivateTriggerCallback method on Level variable passing "this" from Trigger.Activate()

     

    Or also you could create a struct with Trigger and Level to pass to SetEntityUserData instead of trigger only.

     

     

    Thanks for your suggestions. I took your idea and added a static Level pointer to the Trigger class. That solved all my problems.

     

    On a lesser note, where did you get the images in your signature?

  17. Since scaling is not support by the physics system, collision won't work properly if you scale an object.

     

    I am adding a new geometry type based on the CSG brushes used in 3D World Studio, and it will be better for triggers and zones.

     

     

    I don't need physics. I just need the model position, rotation and size (after scaling) so that I can parse those in my code and then create a physics body in code. Is there some way I can do this now? The project is due in two weeks >,>

×
×
  • Create New...