VeTaL Posted August 28, 2010 Author Share Posted August 28, 2010 Yep, i use framework and LUA: //Set Lua variable BP L=GetLuaState(); lua_pushobject(L,framework); lua_setglobal(L,"fw"); lua_pop(L,1); Also, i run level in Editor - still no collisions Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
macklebee Posted August 28, 2010 Share Posted August 28, 2010 what do you have for the tower's object script? try this and see if it makes a difference... require("scripts/class") local class=CreateClass(...) function class:CreateObject(model) local object=self.super:CreateObject(model) object.model:SetKey("collisiontype","2") end Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
VeTaL Posted August 28, 2010 Author Share Posted August 28, 2010 Yes, now player collides with something, but looking like BBox larger then model in about 5 times.... so, i debug i can see Bbox that i made (as on screenshot above), but player cant come near to the model like Bbox 5 times larger... wth Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
VeTaL Posted August 28, 2010 Author Share Posted August 28, 2010 btw, in editor its okay: size of bbox is correct also: how it can work, if script says that "SetKey("collisiontype","2")" and in my code i do say nothing about collision type 2... Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
VeTaL Posted August 28, 2010 Author Share Posted August 28, 2010 i re-generate phy-files (just delete my, so new one would generate), but effect is the same... idk what it is... Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
macklebee Posted August 28, 2010 Share Posted August 28, 2010 Yes, now player collides with something, but looking like BBox larger then model in about 5 times.... so, i debug i can see Bbox that i made (as on screenshot above), but player cant come near to the model like Bbox 5 times larger... wth btw, in editor its okay: size of bbox is correct also: how it can work, if script says that "SetKey("collisiontype","2")" and in my code i do say nothing about collision type 2... i re-generate phy-files (just delete my, so new one would generate), but effect is the same... idk what it is... so only in your game is the phy body incorrectly sized? that makes no sense... and the bounding box has nothing to do with collision... its just the max extents of your model... I would have to see an example of what you are talking about... if you got an example wall or something you can post... as for the collisiontype being set and not having to set Collisions... look at your game's log... you will see that it runs some lua scripts in the beginning, one of them being collisions.lua, where common collision responses are set. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
VeTaL Posted August 29, 2010 Author Share Posted August 29, 2010 //and the bounding box has nothing to do with collision... Sorry, i meaned collision box Looking like some problems while generating level: sbx file is generated by labyrinth generator, i think problem is there. I'll upload example of map and tower in nearest time. Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
VeTaL Posted August 29, 2010 Author Share Posted August 29, 2010 //Yes, now player collides with something, but looking like BBox larger then model in about 5 times.... so, i debug i can see Bbox that i made (as on screenshot above), but player cant come near to the model like Bbox 5 times larger... wth That was a key: as map generator was written by another person, i didnt notice that he scale down models... so, collision box was larger than visual body But, there is still a question, why there isnt collisions without LUA: tower is generated ad saved as Model { path="tower_Form2.gmf" position=-33.000000,0.000000,110.000000 rotation=0.000000,0.000000,0.000000 scale=1.000000,1.000000,1.000000 id=22979576 "class"="Model" "collisiontype"="2" "intensity"="1.0000000000000000" "name"="GeneratedModel" } player is EntityType(_player,3); level is TEntity scene=LoadScene(_SCENE_FILE_NAME_); collisions are Collisions(2,3,1); Collisions(3,2,1); and LUA files are renamed from wall.lua to !wall.lua to disable it See models and level in attachment TestScene.rar Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
VeTaL Posted August 29, 2010 Author Share Posted August 29, 2010 PS:i tested 2 phy-files: first one is box, that i created yesterday, another one is convex hull The fps is almost the same: with boxes there is 51.34 fps, with convex 51.33 PPS: continuing FPS theme, look here: http://leadwerks.com/werkspace/index.php?/topic/2671-just-one-more-interesting-thing-with-fps/ Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
macklebee Posted August 29, 2010 Share Posted August 29, 2010 i can get the collisions to work fine several ways at least with bmax... 1) just use the lua scripts to set the collisiontype and load the collisions.lua file to set the collision response 2) set the scene from LoadScene() to have a collisiontype and then set collision response for the scene and controller (without using the collisions.lua file) 3) parse the scene and set all objects with the name "GeneratedModel" to have a collisiontype of 2 and use the collisions.lua file to set the response... 4) i am sure there are other ways... All three of these methods work fine for me... granted the Lua script might possibly be more useful since you can test inside the editor as well as your game... and also, you don't have to set the same collision response twice... its already built in the engine to take care of that... so instead of this: Collisions(2,3,1); Collisions(3,2,1); you only need to do this: Collisions(2,3,1); Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
VeTaL Posted August 29, 2010 Author Share Posted August 29, 2010 //3) parse the scene and set all objects with the name "GeneratedModel" to have a collisiontype of 2 and use the collisions.lua file to set the response... Ahh.. maybe "collisiontype"="2" dont work, because scene is just loaded, not parsed Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
macklebee Posted August 29, 2010 Share Posted August 29, 2010 //3) parse the scene and set all objects with the name "GeneratedModel" to have a collisiontype of 2 and use the collisions.lua file to set the response... Ahh.. maybe "collisiontype"="2" dont work, because scene is just loaded, not parsed The "collisiontype"="2" only works when you are using the model's lua object script. It doesn't do anything if it doesn't have the script. If you do not use the script, then you have to set the collisiontype by using the normal command: EntityType(<entity>, 2, 1) Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.