Jump to content

Problem with object replacing


Cinkoskink

Recommended Posts

I try to add my own object into a map. It is a box with some texture. I have three object files ( .dff , .col , .txd ). I also have .map file ( with meta.xml ) and .lua script for replacing object.

I think the crucial is .lua file so it looks like this:

addEventHandler('onClientResourceStart', resourceRoot,
function()
outputChatBox('Loding Object')
 
local txd = engineLoadTXD('img/trackB.txd')
-- TXD
engineImportTXD(txd, 8838)
-- COL
local col = engineLoadCOL('img/trackB.col')
engineReplaceCOL(col, 8838)
-- DFF
local dff = engineLoadDFF('img/trackB.dff', 16060)
engineReplaceModel(dff, 8838)
 
createObject(8838, 0.00, 0.00, 20.00, 0.00, 0.00, 0.00)
engineSetModelLODDistance(8838, 500)
end
)

And it works, but i have some strange problem. It looks like collision and shadow mesh is in another position. So there is a place on box when you can't stand because you fall, and when you go other side, you can stand even when you go off the box.

There is a photo: ( You can only stand on this dark place )

meshgu.th.jpg

If anyone knows what i did wrong, i will be pleased to hear it.

Link to comment

I keep saying it and I'll say it again. Custom objects functions are not perfect and even if your code is correct the script may work once and not another time. Your code is correct except for one thing: engineLoadDFF wants you to use 0 for model ID if the model you're replacing is not vehicle.

Link to comment
I change this number to 0, as it is not a vehicle, but nothing's change.

I wonder if it is something wrong with dff or col or txd file, or it's just problem i can't remove?

But i saw more complicated maps with own objects.

Maybe it's the problem with the meshes.. How did you export the models? Were the meshes at 0,0,0 before you exported them (dff and col)? From the screenshot it looks like the col mesh is offset.

Link to comment

With Kam's GTA Script.

So now, I assure myself, that everything is in 0,0,0 point, that col is made good. And now i have very funny situation.

So i put my box ( 40x40x40 ) in the air. Over that i put spawnpoint. So my car land on it. I can see upper wall texture, and two of five of others walls. If i fell on the ground, I can't see my box any more.

Link to comment

Create a Box (or another standart object), then select your map (track or smth), then Attach it to Box. When max ask you about texture material, select 'do not modify id or material'. Later, just delete this Box - polys . In fact, you must receive not offset-object. Same thing with collision mesh.

Link to comment
Create a Box (or another standart object), then select your map (track or smth), then Attach it to Box. When max ask you about texture material, select 'do not modify id or material'. Later, just delete this Box - polys . In fact, you must receive not offset-object. Same thing with collision mesh.

Why not simply change model's pivot point position to 0,0,0?

You can go to Hierarchy tab and choose "Affect Pivot Only" and then change its position to 0,0,0. Either set X,Y and Z spinners (bottom of the window) value to 0 or right-click them (the arrows themselves).

bj99fo.png

Anyway, the problem has been solved via PM.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...