Jump to content

Rick

Members
  • Posts

    7,936
  • Joined

  • Last visited

Everything posted by Rick

  1. So what's happening is that even though I'm calling SetPosition() on the controller and moving it above the Y value of this death plane, the Y value check against the controller and the death plane is still being met. Somehow after I SetPosition() on the controller above the Y value, it still thinks it's below the Y value. Why would that be? Shouldn't SetPosition() on a controller change it's position? So what I did was put a Print() to the log before I move the controller and after I move the controller. Before shows the Y is < the death plane. After shows it's now above the death plane, but it keeps going into this check each cycle. So it's like something is moving it back down each cycle.
  2. Since this is in the Lua forums I assume he wants to use it in Lua. Just my assumption based on some observation
  3. By entity type. I think the raycast method has a parameter that is the entity type to look for. Make that your terrains entity type and make sure nothing else uses that but the terrain to avoid any bugs.
  4. You would have to take his code inside and convert it to lua. He's not doing anything that you can't do in lua, but you would have to do the work.
  5. So does anyone know why this is though? I'm pretty sure I didn't have this issue at first with the editor.
  6. No, the way to do this would be primitive. Create a Vec2 property for the x & z scale values. When that property is updated set the scale on the plane. You probably could set it up to allow scaling with the mouse but you would have to program the mouse picking and movement. That's a good point though and is actually getting me thinking right now. In the Update() method you could check the mouse pick and if it's down over the plane, based on the movement of the mouse you could scale it that way. I'd just use the property because it's easier, but it would just take a few settings of it to get it the right size, but it would be the fastest way to do it.
  7. Create the plane in code. What I do with this is create a plane in the lua file. Then in the update method I have the the plane follor the position of the object.model.
  8. Not sure if this was address above but are you able to provide the whole project for us? Or maybe a smaller version of it producing the same issues?
  9. The strange thing is that in the characters Update() method it sets the position of the character model and the editor model to the controller. I do this instead of parenting. So it's almost as if after setting the position of the controller it still returns it's old position even though it visually is shown at the new position. Maybe that's the issue. Because even when the controller has it position set to the new place I'm able to move the character model around as if the controller is still on it. The reason I think that is, is because I'm checking the editor model Y value to see if it's below this death plane, and because it doesn't follow the controller back up above the dealth plane that criteria of it being below is always met.
  10. This is kind of hard to explain but I'll try my best. I have a few thingoids that act on each other. I have a character thingoid. This has a character model, controller, and the editor model. I also have a DeathPlaneTrigger thingoid. This creates a plane and when target 0 is below this plane it will send a message to target 1 "activate". In this example the character thingoid editor model is target 0 and target 1 is another thingoid called PositionTrigger. This takes target 0 and places it at target 1. In this example target 0 is the character editor model and target 1 is just a pivot thingoid. OK, so the idea is when my character thingoid is below the death plane it'll trigger the position trigger which will put the character back up on the platform. In this position trigger I check to see if the type property (I made) of the target is of "character". If it is, I get the characters controller and call SetPosition() on the controller to the pivots position which is on top of a platform. This indeed does set the position of the controller to where it should. The issue is it's not setting the character model or the character editor model with the controller's new position. The reason it should do this is because in the character's Update() method when in game mode, the character model and character editor model are setup to follow the controller via it's position, and that works great normally, but not when this Position Trigger moves the controller. So can anyone think of any reason that the controller is getting set correctly but the character model and character editor model aren't following it? This is the character thingoid Update() method function object:Update() if GetGlobalString("mode") == "GAME_MODE" then if self.characterModel ~= nil then self.controller:Update(self.rotation, self.move, self.strafe, self.jump, 5000, 10, 0) self.jump = 0 -- reset each frame local pos = object.controller:GetPosition(1) -- the character model must follow the controller -- for the 3rd person camera to work we must also move the object model since that's the target of the camera self.model:SetPosition(pos) self.characterModel:SetPosition(pos) self.characterModel:SetRotation(Vec3(0, object.controller.rotation.y + 180, 0)) -- the t = model:GetTarget(0) if t ~= nil then objecttable[t].playerPivot:SetRotation(Vec3(objecttable[t].playerPivot:GetRotation().x, object.rotation+90, objecttable[t].playerPivot:GetRotation().z)) end end else -- constantly update the controller to the object in the editor object.controller:SetPosition(object.model:GetPosition()) -- make the model follow if self.characterModel ~= nil then self.characterModel:SetPosition(object.model:GetPosition()) end end end This is the PositionTrigger's RecieveMessage() method function object:ReceiveMessage(message,extra) if message == "activate" then t1 = model:GetTarget(0) t2 = model:GetTarget(1) if t1 ~= nil and t2 ~= nil then if objecttable[t1].type ~= nil then if objecttable[t1].type == "character" then -- special case for characters. we want to move the controller objecttable[t1].controller:SetPosition(t2:GetPosition(1), 1) else -- move the model t1:SetPosition(t2:GetPosition(1), 1) end else -- move the model t1:SetPosition(t2:GetPosition(1), 1) end end else self.super:ReceiveMessage(message,extra) end end And here is the DeathPlaneTrigger Update() method function object:Update() if GetGlobalString("mode") == "GAME_MODE" then t1 = model:GetTarget(0) t2 = model:GetTarget(1) if t1 ~= nil and t2 ~= nil then if t1:GetPosition(1).y < object.plane:GetPosition(1).y then t2:SendMessage("activate", "0", "") end end else object.plane:SetPosition(object.model:GetPosition(1)) end end
  11. You can look at Gamelib and see how name tags are done. They draw text onto a "texture" that can be applied to a model. It's not the most straight forward way though. I think your assumption of this being an easy task is correct.
  12. Why does it seem that when I load assets in code it doesn't take? It's looking like I have to close the editor first and then reopen before I can use that assets. For example, I've created an inventory item thingoid. This has 2 properties that are file path properties. One is the filename of the 3D model to use and the other is the filename of the dds file to use for a hud image. When I set these in the editor the code in the Set() is calling either LoadMesh() or LoadTexture(), yet they don't load. BUT if I close the editor and reopen, then it loads them. Any ideas what's up with that?
  13. Here is what I do with this. for k,v in pairs(objecttable) do if v.type ~= nil then if v.type == "inventory.item" then I give an object a .type field. So like object.type = "iventory.item". Then I look through the objecttable and if the object has a .type field and if it's the right text I know I have the object. From there you can get the class if you like, but you can also call functions from that object. Even functions that you created and are not part of LE. Note also though that this depends on where you are calling it from because of when objects get created. I generally give each object an object:Initialize() method. Then before the main loop in the main lua file I loop through all objects in objecttable and if they have an Initialize() method I call it. I also do the same with a Destroy() method and call them after the main loop ends for some clean up stuff.
  14. That's what it was. Those were checked already, probably from the character models I was converting before. I guess I didn't think it would cause issues when exporting a model without a bones or animation. Thanks!
  15. Here is what I did and it didn't work. 1. I extracted just the key2.3ds, key2.mtl, & key-02.tga. 2. Opened key2.3ds in UU3D 3. Expanded Materials tree on the right and renamed it to key02 4. Saved as key2.gmf. Chcked all save options. 5. Opened key-02.tga in Paint.NET and convert to key02.dds 6. Created a key2.mat file with texture0="abstract::key02.dds" shader="abstract::mesh_diffuse_bumpmap.vert","abstract::mesh_diffuse_bumpmap_specular.frag" 7. Open key2.gmf in model viewer and I get nothing. What am I missing? When I look at the gmf model I see material.key-02.tga inside it. So even if I make my mat file key-02.mat it doesn't work. Here is the resulting conversion when I do it. http://dl.dropbox.com/u/1293842/DG.zip
  16. Here is a free model and I tried converting it to gmf via UU3D but I can't seem to see it in the LE model viewer. I'm curious if someone is able to get it viewable in the model viewer and let me know what they did to make it viewable or maybe provide the converted gmf file. http://www.turbosquid.com/3d-models/3d-skeleton-key-model/306184 Thanks
  17. I can only assume he's preparing for when LE becomes crossplatform?
  18. Weird. It worked once, but I can't get it to work again. Ah, there it is. Thanks!
  19. lol, wow I would have never guessed that. Thanks!
  20. Has anyone found a way to unlink a target without deleting the object?
  21. He seems to be looking for a crossplatform solution :/
  22. I think what Josh is saying is if a character is dead, don't call the Animate() method anymore once the death animation plays out to the end. The character should stay at whatever the last animation frame was without making calls the Animate() once they are dead. What you seem to be doing is stopping the frame of the animation on the last frame of the death animation and continue calling Animate() with that last frame every cycle. There is no need to do that once you know you have reached the last frame. Just make a boolean that tells if the character is alive or not. Set it to true when the last frame of the death animation is reached and then put an if check on the 'alive' boolean around the Animate() method to skip calling it when the character is dead.
  23. What you would do is rotate the character mesh (I generally have a pivot there that I rotate and move along with the mesh though). You should then be able to get the mesh/pivot Y rotation value and apply that to the UpdateController() rotation parameter. That will rotate the controller body correctly and keep physics working. Now both your character mesh and controller will be pointing in the right direction.
  24. I think cin.get() is blocking though. It'll halt there until a key is read in, which means your main loop won't run.
×
×
  • Create New...