Jump to content

phy-files


VeTaL
 Share

Recommended Posts

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

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

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.

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

//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.

Working on LeaFAQ :)

Link to comment
Share on other sites

//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

Working on LeaFAQ :)

Link to comment
Share on other sites

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);

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

//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)

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

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...