JakobTischler / MoreRealisticDLCs

A lua/xml project that adds MoreRealistic to the Farming Simulator DLCs
8 stars 0 forks source link

Possible collision issue with Ursus bale wrapper #35

Closed JakobTischler closed 10 years ago

JakobTischler commented 10 years ago

When I detach the wrapper while it is unfolded, it doesn't stand still but rather falls to the grabber's side. Only that the grabber doesn't seem to have a collision, so it goes through the terrain. balewrapper_detached_unfolded

When the wrapper is folded though, it stands as intended, not falling to the right side. balewrapper_detached_folded

Anyone got an idea how to solve this? The mass distribution is: main component: 1t, support: 0.1t, grabber: 0.1t

quadural commented 10 years ago

you have to "rightly" set the centerOfMass for each component. please make another screenshot with the magic F5 key pressed (to see where are the collision boxes on this model)

Are you sure the first component is the "body" on this model ? sometimes, the first component is the "attacher bar"... (and so, if your "bar" is 1T and the body 100kgs, you get what you set ;))

JakobTischler commented 10 years ago

Yes, 100% sure concerning the components:

Ursus Z586: loadFinished(): component 1 (42105/"ursusZ586"): angularDamping set to 0, linearDamping set to 0
Ursus Z586: loadFinished(): component 2 (42166/"ursusZ586_arm"): angularDamping set to 0, linearDamping set to 0
Ursus Z586: loadFinished(): component 3 (42167/"ursusZ586_support"): angularDamping set to 0, linearDamping set to 0

And also, the grabber itself doesn't have any collision: fsscreen_2014_05_21_18_35_56

But I'm now pretty sure the problem lies rather with the centerOfMass. I moved it back 1m on the main component, and now it stands as it should. Should have thought of that before. fsscreen_2014_05_21_18_43_15

Thanks for the help.

quadural commented 10 years ago

The main problem is that we don't know where is the "origin" of each component in the i3d model. and so, we have to "test and try" to get the right values. Don't forget to use the "debugmode" to see the mass on each wheel (for "mr" vehicles and implements) => I always use it to check the mass the implement puts on the tractor and the mass on each implement's wheel

JakobTischler commented 10 years ago

The main problem is that we don't know where is the "origin" of each component in the i3d model. and so, we have to "test and try" to get the right values.

Let's help with that, shall we? :)

Add this to the end of addMoreRealistic.lua:

local drawComponents = function(self, dt)
    if not self.isActive --[[or not self.isSelected]] then return; end;
    for i=1, #self.components do
        local node = self.components[i].node;
        local compX,compY,compZ = getWorldTranslation(node);
        drawDebugPoint(compX,compY,compZ, 0, 1, 0, 1);
        local x, y, z = getCenterOfMass(node);
        if x ~= 0 or y ~= 0 or z ~= 0 then
            local massX,massY,massZ = localToWorld(node, x, y, z);
            drawDebugPoint(massX,massY,massZ, 1, 1, 0, 1);
            drawDebugLine(compX,compY,compZ, 0, 1, 0, massX,massY,massZ, 1, 1, 0);
        end;
    end;
end;
Vehicle.update = Utils.appendedFunction(Vehicle.update, drawComponents);
quadural commented 10 years ago

really nice. Thank you !