Jump to content

Haydenmango

Members
  • Posts

    434
  • Joined

  • Last visited

Everything posted by Haydenmango

  1. Nice tutorial! I was just starting to use MakeHuman and then I found this, very useful information. BVH hacker tool is great as well! I do have one question though, how do you go about playing your animation in game? I got my character into leadwerks (gave every material animation shaders) and the animations play inside of the model viewport but when I try to make the animations play in-game my character does nothing. My script is really simple just like this-- import "Scripts/AnimationManager.lua" function Script:Start() self.animationmanager=AnimationManager:Create(self.entity) self.animationmanager:SetAnimationSequence(1,.05) end I am guessing it is some sort of hierarchy issue but I am not sure yet. My character is wearing jeans and has hair, do I have to do anything special to get that to work correctly?
  2. You could also mess with giving the ball a higher mass, adding more or less force in that script, or even changing your worlds gravity amount.
  3. It seems that those are older functions from LE 2. At the moment I do not believe such functions exist (at least for lua). I had a similar issue so I made a little script for my ball to make it bounce. It looked like this - function Script:Collision(entity, position, normal, speed) self.entity:AddForce(0,.25*speed,0) -- Add Global force to make the ball bounce upwards. self.entity:AddForce(0,.25*speed,0,false) -- Add Local force to make the ball have a random bounce end
  4. Hey shad just wanted to ask if self.shader:SetFloat("cloudscale",self.cloudheight) -- lesser is bigger is supposed to be self.shader:SetFloat("cloudscale",self.cloudscale) -- lesser is bigger in the UpdateWorld() function.
  5. @gamecreator - No Problem! If I knew C++ I would post a version for that as well. @Josh - I just got bored and decided to give it a try because it really changes the way I build my map. Now instead of placing rocks to block paths I can just place steep terrain slopes! As soon as it is officially implemented I will gladly throw this code out because I have found certain issues. Issues Found: On certain slopes the slide will push you up the slope instead of down due to the pickInfo.position not always hitting the correct spot which makes you face the slope and move forward instead of facing away from the slope and moving forward.... I am starting to think that using a check in a Collision() function might work better for getting a position than doing the pick but I haven't tried it yet. Most of the time it can be fixed by sculpting your terrain a bit more in the areas where you have trouble.
  6. That looks like a lot of fun! I love classic shooters. Also the evil faces on the gray asteroids are hilarious.
  7. I finally got around to adding this to my project. It looks sooo amazing. You are the best Shadmar thank you!!! Here is a little preview of what it looks like in game. It is speed up to be 5 times faster so the video wouldn't be super long.
  8. I figured out how to do a basic terrain slide for the character controller using some code! I thought someone might find this useful since character controllers can climb really steep slopes at the moment. Code: local pickInfo=PickInfo() local campos=self.camera:GetPosition() local playerPos = self.entity:GetPosition() if (App.world:Pick(campos,playerPos-Vec3(0,1,0),pickInfo,0,true,Collision.Scene)) then if not pickInfo.entity.script then if pickInfo.normal.y<.41 then local dir = Vec2(pickInfo.position.z-campos.z,pickInfo.position.x-campos.x):Normalize() self.entity:SetInput(-Math:ATan2(dir.y,-dir.x), 10+pickInfo.position.y, 0, 0, false, 1.0, 0.5, true) campos = Vec3(playerPos.x, campos.y ,playerPos.z) if campos.y<playerPos.y + self.eyeheight then campos.y = Math:Curve(playerPos.y + self.eyeheight, campos.y, 2) else campos.y = playerPos.y + self.eyeheight end self.camera:SetPosition(campos) return end end end Usage: This code goes in the UpdatePhysics() function and must be placed before your characters SetInput() function to override it. The value here - if pickInfo.normal.y<.41 then - (.41) can be changed to a value between 0 (you can climb anything) and 1 (you can't climb anything). Also the value here - SetInput(-Math:ATan2(dir.y,-dir.x), 10+pickInfo.position.y, 0, 0, false, 1.0, 0.5, true) - (10+pickInfo.position.y) can be changed to make you slide faster or slower. The way the code is set up it only checks for entities without a script with Scene Collision which includes terrain. Example Usage: if window:KeyHit(Key.Space) then jump = 9.2 self.entity:EmitSound(self.sound.jump,5,.12,1,false) playerMovement = playerMovement * 1.9 else local pickInfo=PickInfo() local campos=self.camera:GetPosition() local playerPos = self.entity:GetPosition() if (App.world:Pick(campos,playerPos-Vec3(0,1,0),pickInfo,0,true,Collision.Scene)) then if not pickInfo.entity.script then if pickInfo.normal.y<.41 then local dir = Vec2(pickInfo.position.z-campos.z,pickInfo.position.x-campos.x):Normalize() self.entity:SetInput(-Math:ATan2(dir.y,-dir.x), 10+pickInfo.position.y, 0, 0, false, 1.0, 0.5, true) campos = Vec3(playerPos.x, campos.y ,playerPos.z) if campos.y<playerPos.y + self.eyeheight then campos.y = Math:Curve(playerPos.y + self.eyeheight, campos.y, 2) else campos.y = playerPos.y + self.eyeheight end self.camera:SetPosition(campos) return end end end self:UpdateFootsteps() end self.entity:SetInput(self.camRotation.y, playerMovement.z, playerMovement.x, jump , self.crouched, 1.0, 0.5, true) Let me know if there is a better way to do this and Enjoy!
  9. in your script is self.Gladios equal to anything? You need to make it reference the prefab if you haven't done that. Something like - Script.Gladios=Prefab:Load("Project/Prefabs/prefabname.pfb") If that isn't the issue then could I see how your script looks now?
  10. One thing before I go on; are you using the Indie Edition (Lua) or Standard (C++)? Everything I am saying is relative to Lua but it can probably be translated to C++. edit -- it seems you are using C++ so this example code I'm posting won't copy over exactly. You will need to change it a bit to get it to work. Is close but I was implying you could create a table for your items. This would make the number correspondence much easier. For example in your Start() function you can assign numbers to a "item" table. In code it would look like this - function Script:Start() self.item={} --self.item is now a table self.item[1]=self.gladios --the first item in your table is gladios now self.item[2]=self.weapon2 --add other weapons self.item[3]=self.weapon3 end Then when you want to instance(spawn) one of those items randomly you would do - local item=self.item[math.random(1,3)]:Instance() This makes a new Instance of one of the items assigned to your self.item table using a random number. You can replace math.random(1,3) with whatever number your random number generator creates. Yeah the method I described in my first post is better for spawning things like resources outdoors because it requires space for the entity to drop into place but it does set the entities mass back to 0 once it hits the ground which prevents rolling and other physics things. If you have a fixed location for your spawn points you should be able to just adjust the entities rotation before placing it into position with SetRotation(). That requires a bit of testing to find the perfect rotation for the set spawn point but it should work fine once you get it.
  11. Well there is no easy AlignToTerrain() function that I know of so for making the item spawn on the correct axis you will probably need to do some coding. What I do in my game is spawn the item above its location and give it a mass of above 1. Then once the item hits the ground its mass goes to 0 and it sits still. It would look something like this in code - local item=self.item:Instance() --spawn item item:SetPosition(self.itemlocation+Vec3(0,1,0)) --set Item above spawn location item:SetMass(1) --set Items mass to 1 so it begins falling item.script.falling=true --set falling to true so that the items Collision() function will work function Script:Collision() --this collision function needs to be within the Items Script. if self.falling then --check for falling if entity:GetCollisionType()==Collision.Scene and not entity.script then --terrain check self.entity:SetMass(0) --set mass to 0 to become still end end end That won't work for everything but maybe it will help a bit. For getting numbers that are relative to items you would need something like this to spawn the item - local item=self.item[self.itemnumber]:Instance() Let me know if this helps at all!
  12. Or http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/camera/camerasetzoom-r207 ?
  13. I can confirm that this is some sort of bug. I just tested the map and got the same results. Navmesh isn't covering the csg boxes and it isn't following the terrain. This was fixed. - http://www.leadwerks.com/werkspace/topic/10033-nav-mesh-isnt-big-enough/
  14. Okay for vegetation you need these settings for the material - BlendMode: Solid Two Sided: Yes DepthTest: Yes DepthMask: Yes This is probably because your BlendMode was set to Alpha. For the character Issue try to go to the Physics Tab and set the Character value to 180.
  15. Yeah I have been having this issue as well for quite some time, I had forgotten to post a bug report though. Here is another post that discusses the same issue. - http://www.leadwerks.com/werkspace/topic/10140-scene-tab-suggestions/
  16. My Top 3 would be 1. Water, 2. Character Controller Improvements, and 3. Vegetation System. Following right behind that would be Editor Optimizations (Mostly the Scene Tab) and Publishing Improvements (package compression and encryption in publish process).
  17. Well I am not sure what exactly you want to do but here are some of the functions you would use - Camera Zoom - http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/camera/camerasetzoom-r207 Point at Entity (center in on entities) - http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/entity/entitypoint-r167 Move (good for panning and general camera movement because it doesn't detect collision) - http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/entity/entitymove-r165 Turn (Use this instead of SetRotation() to turn the camera over time) - http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/entity/entityturn-r29 There are many more (SetRotation(),SetPosition(), etc.) but these should be good enough to make a simple scene.
  18. It would be cool if the Listener could control the Master Volume of every sound in a game. Like if I could do self.listener:SetMasterVolume(0-100). 0 would be No Volume while 100 would be Maximum Volume. This would make volume control much easier than having to manually decrease/increase the volume for each sound every time they are played.
  19. I just noticed that the jump.wav sound file in the MyGame project is a stereo file yet the FPSplayer.lua script uses it with EmitSound() and it still plays the sound. Also I have been using many stereo sound files in my project along with EmitSound() and all the sounds still play. Does playing a stereo sound file with EmitSound() create any problems? I tested it out and it seems like the 3D sound doesn't work although the sound still plays.
  20. Also, I think that only developers can make blog entries. I would like to use blog entries rather than status updates for certain things.
  21. Hmmm after playing my game today I noticed that my torch fire particle emitter would stay in sight instead of disappearing! Was this changed recently?
  22. I do not believe there is an area like this yet but I agree that it would be a good addition. Welcome to the Leadwerks community!
  23. This is something I have been testing a lot recently. Once my memory doubles the GC will cut it down but then it waits till my memory doubles the amount that it was at when it was cut down. Meaning if it collects memory at something like 800 then it will do its next memory collect at 1600 and the next at 3200 and then 6400 and then etc. Obviously the number gets to high eventually and then the game crashes due to being out of memory. This is what I have observed and is why I looked into this at all. If I call collectgarbage() every frame there are no leaks my memory stays the same(without using collectgarbage('setpause',100) in my App Start() function). I wonder, why are there even controls for the GC if it supposedly runs perfectly on its own? I haven't given up just yet. This project is a learning experience for me so I would rather not just give out my project and have all the answers given to me by other people. Also I tested my game (with collectgarbage('setpause',100) in my App Start() function) all night without a crash or any other weird behaviour. It ran for 10 hours(8-9 hours longer than usual), I exited out because I wanted to read this forum post. I saw no bugs the whole time I was playing and everything was working great.
  24. I haven't and I am getting to the point where I may begin giving out my source code since I do agree with you on the point that I may be completely wrong about everything/some of the things I've done; after all I haven't been doing this for to long. Also I have like 15 or so scripts and at least 4 of them are 600-1000 lines long so it wouldn't really help to just post snippets in this case but again I will think about giving out the source code if I give up. I need to do more tests though still since I just started using this function and now each test run is 3+ hours. No I know he is busy. If he wanted to adopt the game for the workshop or something that would be cool but I am not holding my breath.
  25. That's what I have been doing and I can't narrow it down to anything other than I have just to many things happening. I have done memory tests on everything for hours everyday on every line of every script and haven't added anything but simple bug fixes to my game for the past 2-3 weeks now. There aren't any problems I can find at this point. It is a powerful line of code if you haven't read into what it does. Also I am not blaming Leadwerks for doing anything I was asking if it is possible that the Lua Garbage Collector isn't fast enough for some situations. My entities have no physics being applied to them, don't animate, don't move, aren't visible, and their scripts return end unless they are within a certain range so everything is as optimized as I can get it to be. When my entities are nearby some of them have sightly complex scripts that they use so even if I stand still the environment still generates decent amounts of memory. Yes it would crash because of Lua Error:Out of Memory 6 GB RAM (5.89GB usable) on my system.
×
×
  • Create New...