Jump to content

Haydenmango

Members
  • Posts

    438
  • Joined

  • Last visited

Everything posted by Haydenmango

  1. Very true. I just came to that solution a few minutes ago as well. I still don't like this though(moving my weapons manually doesn't work well with my animations and it looks really choppy). I wish someone could confirm whether this is just how the engine works or if I am missing a function to correct my mistakes. When you have a parented entity and set its parent to nil it shouldn't keep the characteristics of its previous parent.... or should it? edit- When I search around for more information about SetParent() it only says so SetParent() should only change the orientation of the entity. It seems SetParent() isn't well documented or bugged because my child entity is also inheriting its parents Physics Shape.
  2. That would work but I have lots of weapons all over my map. If I don't use SetParent() then each one of those weapons is going to need an UpdateWorld() function which means all of those weapons will be constantly looping through that function to check if they are "active" rather than just being turned on and off when they are being used. I think that is where I will lose performance. Oh well though... for now I may have to do it manually instead of using SetParent(). It is just such a bummer because it seems like it wouldn't be impossible to set an objects shape back to normal after its parent is cleared. Thanks for the help/suggestions by the way Yougroove.
  3. I was really hoping I wouldn't have to do this-- but it is the only thing I have tried that fixes the problem. Is there really no way to get rid of the shape my weapon inherits from its parent?? Is this intended behaviour or am I missing something? Things would be much more simple if I could just use SetParent() instead of constantly checking if my weapon is being held then constantly moving it if it is.
  4. I don't think you understand. I just said it doesn't even work when I don't mess with my weapons shape. And in my video the problem occurs once the weapon is dropped. Once my weapon is dropped it has some sort of extended collision shape as you can see in the video. So no it did not work for the first stick in my video. In case you still don't get the shape part this is what my original code was(this was the code used in the video)-- --pickup code if window:KeyHit(Key.G) then if (App.world:Pick(self.camera:GetPosition(),Transform:Point(0,0,self.useDistance,self.camera,nil),pickInfo,0,true)) then if pickInfo.entity.script then if pickInfo.entity.script.weapon then if self.carryingEntity==nil and self.weapon~="torch" then if self.weaponentity~=nil then self.weaponentity.script:Drop() end self.weaponentity=pickInfo.entity self.weapon=self.weaponentity.script.name self.weaponentity:SetMass(0) self.weaponentity:SetCollisionType(Collision.None) self.weaponentity:SetPosition(self.palm:GetPosition(true)) self.weaponentity:SetRotation(self.palm:GetRotation(true)+self.weaponentity.script.rotation) self.weaponentity:SetParent(self.palm) self.weaponentity:SetShadowMode(0) end end end end end --drop code function Script:Drop() self.entity:SetParent(nil) self.entity:SetMass(self.mass) self.entity:SetCollisionType(Collision.Prop) self.entity:SetShadowMode(1) end This results in the same issue shown in my video.
  5. Changing my weapons shape was what I thought would fix this problem but it doesn't. My issue still occurs whether I change my weapons shape or not. Here is my code so you may understand what is happening-- --pickup code if window:KeyHit(Key.G) then if (App.world:Pick(self.camera:GetPosition(),Transform:Point(0,0,self.useDistance,self.camera,nil),pickInfo,0,true)) then if pickInfo.entity.script then if pickInfo.entity.script.weapon then if self.carryingEntity==nil and self.weapon~="torch" then if self.weaponentity~=nil then self.weaponentity.script:Drop() end self.weaponentity=pickInfo.entity self.weapon=self.weaponentity.script.name self.weaponentity:SetShape(nil) --you can comment this out and the problem still occurs self.weaponentity:SetMass(0) self.weaponentity:SetCollisionType(Collision.None) self.weaponentity:SetPosition(self.palm:GetPosition(true)) self.weaponentity:SetRotation(self.palm:GetRotation(true)+self.weaponentity.script.rotation) self.weaponentity:SetParent(self.palm) self.weaponentity:SetShadowMode(0) end end end end end --drop code function Script:Start() self.shape=self.entity:GetShape() self.shape:AddRef() end function Script:Drop() self.entity:SetParent(nil) self.entity:SetShape(self.shape) --you can comment this out and the problem still occurs self.entity:SetMass(self.mass) self.entity:SetCollisionType(Collision.Prop) self.entity:SetShadowMode(1) end
  6. So I have a player and a weapon. I pickup the weapon by parenting it to my entity. I drop the weapon by calling weaponentity:SetParent(nil) and then it drops like it should. My problem is that the weapons collision shape doesn't change back to normal when it drops. I imagine that it keeps the shape it inherited from its parent. It is hard to describe so I added a video to show what's going on. If anyone knows what I can do to fix this let me know. I have tried to change the weapons shape back to its original shape when it is dropped but that hasn't worked. --video https://www.youtube.com/watch?v=woqWma6JJUQ
  7. One way I can think of doing this is giving all of your collision objects a unique mass like 2.2. Then the script would look like this- if mass==2.2 then self.carryingEntity=pickinfo.entity elseif mass>0 and mass<=self.carryweight etc. That would make any object with a mass of 2.2 usable though so be careful with that method...it can get kind of messy. edit--im tired and my previous suggestion actually doesn't make that much sense. I am guessing that your collision objects have a mass of 0 and that is why they are unusable? or are they hidden? If they have a mass of 0 you could give them a script with something like Script.object=true then change your fpsplayer script to check for it like-- if pickinfo.entity.script then if pickinfo.entity.script.object==true then self.carryingEntity=pickinfo.entity end end local mass=pickinfo.entity:GetMass() ..etc if your object isn't to complex just do what rick suggested below.
  8. It should still work. I have a box that uses 5 "collision" objects to create the physics for the box and I can pick it up using the pickup system. You might have to hide the "collision" objects that are parented to your entity so that your pick hits the entity and not the "collision" object. That worked for me at least and it kept the physics I wanted even though the objects were hidden.
  9. I started having this issue before I even used a terrain. I had a giant BSP box for the ground and things still fell through. No matter how thick the box was entities would still fall through. It did happen less often then it does when I am using terrain but it still happens nonetheless. Also I am using leadwerks terrain and I don't think there is a way to just thicken the terrain.
  10. Good idea. I may make an attempt at that as I still am having this issue. Scaling everything up didn't work because Character Controller physics wouldn't scale with everything else. Scaling up the throwing objects didn't solve the issue either.
  11. oh geez I feel dumb now. Next time I'll search harder before posting noob questions. Thanks. I tried using sharpen with soften mipmaps and it doesn't seem like they counter each other but I still don't fully understand these features so I'm not sure what to look for.
  12. Noob question: What does the soften mipmaps option on textures actually do?
  13. Looks like a good start! Eventually I will have to tackle GUIs as well and I only have Lua (so I can't use tjheldnas ). I will keep track of your progress (if you post updates on this) and learn from your learning!
  14. That's a nice looking GUI you got going there Patrik. *thumbs up* (reached my like limit today) Little update on The Hunt For Food (game I'm working on). I added a Terrain and made my rabbits follow the terrain using the Align to Ground script by Beo6. thanks Beo6! More info in the short video and video desciption. update video- align to ground script link- http://leadwerks.wikidot.com/wiki:align-to-ground
  15. Sorry, old post but... Does PhysicsDriver::GetCurrent()->virtual void SetCollisionResponse(const int collisiontype0, const int collisiontype1, const int response); work in Lua? I tried converting the code but it isn't working for me. This would be super useful for a game I am working on at the moment.
  16. Well I learned something today! I've only been using pick::entity so far for whatever reason. This information could be useful in the documentation because I would still be using Entity::Pick over Camera::Pick as there is no way to tell that Entity::Pick 'shouldn't be used by the end user, except in special cases.'
  17. I may be totally misunderstanding you and if I am then disregard this. But the Entity::Pick() function works pretty much the same as the Camera::Pick(). The only difference I can see is the option for x and y coordinates for the screen(while using camera pick) and the option for Vec3 starting pos and Vec3 ending pos(while using entity pick).
  18. I noticed you are using the Camera pick function. You can set the Pick distance when you use the entity pick instead- http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/entity/entitypick-r158 might be worth testing out to see if it goes any quicker but it sounds like you got it working pretty good.
  19. Awesome, thanks for clearing that up for me Rick!
  20. I could do that but the thing is the log is the least of my worries. I have much smaller models (rocks,food,etc.) that I have to account for as well so it seems everything just needs to be bigger.
  21. Thanks Rick that actually makes a lot more sense then using Release(). A bit off topic but when trying to get a Script to run do you have to call App.script:Function() or does App:Function() just work?
  22. I think it may have to do with Calling:Clear() on your current World and creating a new one for your new map. Check out this code below. if self.mapnum==1 then self.mapnum=0 self.currentmapnum=1 self.world:Clear() Map:Load("Maps/Fight Fire with Fire.map") elseif self.mapnum==2 then self.mapnum=0 self.currentmapnum=2 self.world:Clear() Map:Load("Maps/Save the Trees 2.map") end It's kind of hard to tell with the example you gave though. Maybe if you also showed the App.lua I could get more insight as to what is going on.
  23. Hmm I may have to scratch my game idea if this is the case.... most of the combat in my game was based around throwing objects at enemies. The log you see in the example video was going to be the slowest and probably one of the bigger thrown weapons. Hmmm I just had an interesting thought though.... What if I scaled everything up a good amount so that the objects still look small but are actually pretty big??? hmmmmmm... Thank you for the responses!
  24. I agree that documentation could be useful for this function as I am not completely sure what values work. Just a guess but maybe 1 would be static and 2 would be dynamic. Not sure how lights work but judging from cassius' post it's probably something similar like self.model:SetShadowMode(Light.Static) or self.model:SetShadowMode(Light.Dynamic).
×
×
  • Create New...