Jump to content

FBX from MODO Cannot Be Picked Up?


 Share

Recommended Posts

Alright, I am running into a different issue than the one from Blender I had started a thread on last week or so. I am testing getting 3D objects from MODO to Leadwerks via FBX. So, far, the model comes into Leadwerks at the correct size. If I have a "child" object named "collisionhull", then collision works perfectly in Leadwerks. And, unlike the Blender objects, I can select the models from MODO in Leadwerk's viewports without an issue. BUUUUUT ... there is another issue.

Using the stock fpsplayer model, I cannot PICK UP the objects exported from MODO.

For example, when I am close to an object with physics set to Rigid Body, Collision Type set to Prop, and a mass other than 0.0, a "hand" icon appears indicating I can pick up the object by pressing the "E" key. Hey! It's fun to toss stuff around, right? With the objects exported from Blender, this works perfectly. However, with the objects exported from MODO, the hand icon does not appear and pressing "E" does nothing. 

Everything else works. I can push the object around by walking into it. I just can't pick it up like I can other objects. So, any ideas here? I've attached the test model.

ModoCube2.fbx

Creating professional 2D and 3D content is my passion!
Monkey Frog Studio

Link to comment
Share on other sites

Additional information - If I open the object in the Leadwerks' model viewer, collapse the model, and add a basic physics object (box, etc.), the objects can then be picked up.

So, here's what's going on in Leadwerks 4.5:

Blender objects (with collision hulls made in Blender) operate normally in-game (can be collided with and can be picked up, depending on mass), but cannot be selected in the Leadwerks viewport (only in the Leadwerks scene tree). Collapsing them and adding a basic physics object (box, etc.) fixes the viewport selecting issue.

Modo objects (with collision hulls made in Modo)  can be collided with in-game, but cannot be picked up via pressing "E". They can be selected in the Leadwerks' viewport and scene tree with no issues. Collapsing the model in the model viewer and adding a basic physics object (box, etc.) allows the object to then be picked up in-game.

Do any objects imported into Leadwerks via FBX work correctly when you make a custom collision hull for them (if both the object and collision hull are exported at the same time)? For most instances, using the basic physics object will be fine as simple shapes will be all I'll need. But there will be times when a custom collision hull will be needed. So, what's the answer here?

Creating professional 2D and 3D content is my passion!
Monkey Frog Studio

Link to comment
Share on other sites

At the moment, I would say collision hulls are broken and probably have a lot to do with with the same thing that is happening here:

A couple of things to note:

- Your model can be picked up by setting the child mesh's mass to 1 but this breaks the physics and the collision hull will not move with it. (also requires the child mesh's gravity to be turned off)

- Make sure you delete or at least don't export your modo directional light and camera when exporting the model (I don't think this is an issue but no reason to have these as children in the model)

 

At the moment, I think would majority of people could get by with built in physics shapes being created, but if someone just has to have a custom shape before this issue gets fixed then:

- Model custom shape (keeping in mind the origin of the actual model you are wanting to apply it towards).

- Import in LE, view in asset browser, right-click and pick Generate Shape --> Polymesh or Convex Hull

- Save the new PHY file as the same name as actual model that needs a custom physics shape

- Place the actual model into scene and it will have your custom shape applied automatically.

  • Thanks 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

This is a code problem not a problem with your art pipeline. Here's the code to pick up an object:

if self.carryingEntity == nil then
	mass = pickInfo.entity:GetMass()
	
	--Pick up object if it isn't too heavy
	if mass>0 and mass<=self.maxcarryweight then
		self.carryingEntity = pickInfo.entity
		local p=pickInfo.entity:GetPosition(true)
		self.effector = Joint:Kinematic(p.x,p.y,p.z,pickInfo.entity)
		self.carryingobjectcollisiontype = self.carryingEntity:GetCollisionType()
		self.carryingEntity:SetCollisionType(Collision.Debris)
		self.carryingEntity:SetDamping(1,1)
		--self.effector:SetFriction(1000,1000)
		self.carryingEntity:SetSweptCollisionMode(false)
		self.carryrotation = Transform:Rotation(pickInfo.entity:GetQuaternion(true),nil,self.camera)
		self.carryposition = Transform:Point(pickInfo.entity:GetPosition(true),nil,self.camera)
	end
end

So you can clearly see, if the picked object has zero mass it's not going to work. What can we do? Either change the structure of the model, as suggested, or we can modify the code by creating a new GetMass() function that looks for a parent with non-zero mass::

function MyGetMass( entity )
	local mass = entity:GetMass()
	if mass > 0 then return mass end
	local parent = entity:GetParent()
	if parent ~= nil then return MyGetMass(parent) end
	return 0
end

And then call that instead of the regular GetMass() method:

mass = MyGetMass(pickInfo.entity)

 

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Thanks for the reply, Josh. I do have a question/observation, and that's mainly because I am not the brightest bulb in the pack (and not yet a programmer).

I hear what you're saying about this being a code problem and not a problem with my art pipeline, but isn't this something more than a LUA issue? Isn't this more of a Leadwerks issue? The reason I say this is because I am importing an FBX file from TWO DIFFERENT sources and getting TWO DIFFERENT outcomes. The FBX file from Blender cannot be selected in the Leadwerks' editor's viewports. That's not a LUA issue, right? The FBX file from MODO can be selected in the Leadwerks' editor, but it cannot be picked up in-game. That could be a code issue. However, the FBX file from Blender CAN BE picked up in-game. 

This seems to indicate that there is something going on either with Blender's FBX export, MODO's FBX export, or Leadwerks' FBX import (or all of the above?). Else, each FBX file would be the same in Leadwerks. 

From MODO I tried two different FBX exporters ... FBX 2015 and FBX 2018. Both give me the same results (can be selected in the Leadwerks' editor's viewport, cannot be picked up in-game no matter what is set for mass). 

Creating professional 2D and 3D content is my passion!
Monkey Frog Studio

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