Collision

I make UCX_xxx collision in my 3d program and import to UDK which mostly works, except on smaller objects such as a narrow fence, for example. After import to UDK the narrow fence collision doesn’t show up on the mesh… and of course doesn’t collide. I was aware of this before and simply ‘thickened’ the collision -making it wider, longer and then the collision showed up after import to UDK. The problem with the fence, I can’t really widen it. It’s about 4uu wide, and I’ve stretched the UCX to about probably 8uu or slightly more.

For the fence presently I’m using UDK collision boxes and that works ok.

Is there some switch I’m missing here to force UDK to pickup on the narrow fence and narrow/small collision objects?

sorry to recommend this again,but per poly collision is the way to go for objects like this.not only does it work,but you can shoot through the gaps too.

I use per poly on almost everything I make and it doesn’t affect performance,even on my factory map with 20,000 actors.

In my case, using the random foliage, wich places trees around the player, the low performance are very noticeable with a specific tree ( StaticMesh’PivotPainterExamples.Static.Tree’ ) using per poly collision. The other trees are using UCX and are faster. But I think that the low performance is when the trees are spawned, not when they are placed.

Thank you fellas for suggestions.

As you say per-poly works - UT2004 is per-poly and I’ve seen stacks of stuff crammed into custom maps. With UCX I’ve been kinda aware of ‘shooting thru’ problems but the player won’t be shooting thru my fences or cracks due to positioning… so far XD. My game will be co-op probably lessening the intensity of game experience, looking for cracks to shoot thru etc. The mesh in question is 40,000 verts, and the UCX_ total isn’t more than around 300 verts so I have to go with the latter. Forests, foliage, argh, Cobalt, they are nightmares of lag that demand UCX. :slight_smile:

Although I use per-poly on floors because UCX causes only the default texture sound to be used -it’s ‘walk on rock’ sound. So if the floor is metal texture and I use per-poly, the metal texture footstep sound plays, or whatever texture the player is walking on will play the correct footstep sound.

Hi there,

I use 3dsmax2013 for modelling all my environment. I model the entire map (level, props, trees, objects) inside 3dsmax, i create the complete map inside 3dsmax, the way it will look inside UDK, then i just export and reassemble the level in udk, however i use a lot of “tools” and maxscripts to make it work perfectly, and it does!!!

First of all, i divide my map into such elements, inside 3dsmax using selection sets:

1- Level Geometry, which is the “architecture” of my level, where the player will walk and interact directly, like floors, walls, and so on. For these meshes i make them all poly collision, and make them have the highest lightmap size (512x512), because the marjority of the shadows will be cast on them.

2- Background Models, which are some long distant models, like buildings, houses, that are far away from the player, and they are meant to make the skybox match with the overall scene, to make it look infinite, at the horizon. I use very small texture maps like 128x128, 256x256, and the lightmap size 32x32, or 64x64, depending on the size of the model.

3- Level Props, which are the other models, from small to big, which are part of the scenery, like cars, light poles, trash can, wood crates, and so on. For these models i make UCX collision models inside 3dsmax. I created/adapted a maxscript to automatically create collision models.

This workflow works perfectly for me, althought I am using a modified version of UDK, however it works, I tested also on UDK February 2015.

If anyone is interested, here follows my “secret” tools.

For mesh placement:

The way you can easily match the same position of your models from 3dsmax to UDK is following this tutorial and downloading this toolbox. But you need to have a basic understanding of PHP Scripting and have installed in your PC a PHP Server (i use NucServ):

http://www.lagspike.com/converting-a-vmf-valve-map-file-to-udk/

What it does, this awesome script reads all fbx filename, also identifies the pivot point location of each mesh, and exports a t3d file which you simply copy and paste on UDK viewport to have the objects correctly pasted inside UDK viewport.

The script is setup for reading ASE files, however, you just edit the php script and type FBX instead of ASE.

This way, all your map assets will be placed in UDK exactly in the same position they are inside 3dsmax.

For mesh collision:

I modified this maxscript to create a valid UCX collision model for UDK:

http://www.scriptspot.com/3ds-max/scripts/encapsulator

This is the script, just copy this inside maxscript editor and run Evaluate all. Then go to customize 3dsmax user interface and add this script as a new menu wherever you want. It will be under category UDK Tools.

macroScript UDKCollisionGenerator
category: “UDK Tools”
tooltip: “UDKCollisionGenerator”

(

(
	max create mode
	varmeshType = 4
	sel = selection as array
	for i in sel do
	(
		addmodifier i (MassFX_RBody ())
		m = i.modifiers#MassFX_Rigid_Body]
		m.meshType = 4
		m.SetRBMeshVertexLimit 1 32

		if varmeshType == 4 do (a = mesh prefix: ("UCX_" + selection[1].name+"_") mesh:(m.GetRBMeshShape 1); a.transform = i.transform; a.scale = [1,1,1]; a.xray = on)
		deletemodifier i i.modifiers#MassFX_Rigid_Body]
	)
)

)

You just select an object, and run this new script.

This will work for one mesh only, you select each one individually and run the script. But if you want for multiple objects, after installing this script, you must create a new macro in 3dsmax. Just copy the below text to maxscript editor and Evaluate All, then add this script to a new menu:

macroScript UDKCollisionGeneratorMulti
category: “UDK Tools”
tooltip: “UDKCollisionGenerator for Multiple Objects”

(

(
max modify mode
selObjsArr = selection as array
for o in selObjsArr do
(
select o
macros.run “UDK Tools” “UDKCollisionGenerator”
)
)

)

That’s it, you can select how many objects you want, and run this script that will automatically create the collision models, using the object name with prefix UCX (but it may take long time depending on the number of objects selected). But just a problem, is that it adds the sufix 001, so you can use this maxscript to remove these sufix:

http://cbuelter.de/?p=352

And after my level in 3dsmax is setup, i just run this other magic script to batch export all the models of my map:

http://josbalcaen.com/scripts/max/batch-exportimport/

I hope these tips are usefull. :cool:

Wow, you have it all worked out with the meshes!

Any ideas that could help my collision problem? I make UCX_xxx collision in my 3d program and import to UDK which mostly works, except on smaller objects such as a narrow fence, for example. After import to UDK the narrow fence collision doesn’t show up on the mesh… and of course doesn’t collide. I was aware of this before and simply ‘thickened’ the collision -making it wider, longer and then the collision showed up after import to UDK. The problem with the fence, I can’t really widen it. It’s about 4uu wide, and I’ve stretched the UCX to about probably 8uu or slightly more.

Brother, for any mesh that does not work, you can make it poly collision, simple. I forget to say that for props on which the player will have to pass / shoot through i make them poly collision. The way to enable poly collision:

Open up the mesh in the UDK Mesh Editor, and in the top-right pane, scroll down to the bottom. Uncheck:
Use Simple Box Collision
Use Simple Line Collision
Use Simple Rigid Body Collision

And if your mesh has multiple materials applied, it will have multiple elements also, so you need to manually enable per poly collision on each of these elements inside the static editor.

On my custom UDK Version (UDK Ultimate), all the imported fbx files to UDK will automatically have enabled per poly colision and shadow casting on the elements, so there is no need for me going there one by one and setting it up.

But do you use 3dsmax?

If so, follow my above instructions, they will work perfectly. Before creating my game, i studied UDK for almost 1 year until be able to develop a consistent workflow, and now, i can port one entirely level from 3dsmax, complete, fully playable level, with all the lighting environment setup in just 3, 4 days (working like 5 hours by day)

If you want I can share with the complete pipeline i am using, step by step, also the maxscripts i am using. But you need use max2013 for it.

Once i finished to model my level in 3dsmax, textured all the models, in just few clicks i have all these meshes inside UDK, also with all the lighting setup working (i use the default UDK templates, MidDay, Morning, Evening, Night).

I even have a fantastic plugin that procedurally generates render maps from texturing (VIZ Automaterial Plugin), which works even better than crazy bump. Then i created a custom maxscript that automatically adds specular and normal map to the materials inside 3dsmax using the correct UDK naming convention, so, whenever i import these meshes in UDK, they come with normal and specular map, and believe me, they look very good. Off course i fine tune some materials after importing them. But my pipeline works very well.

Cheers.

some nice work there udkultimate.I will try the max script you kindly posted.

as for the exporting you can simply build you level in max,select all meshes and set the pivot point to 0,0,0…then when you import and place in udk,again set all meshes location to 0,0,0.they are all lined up correctly.

but as I say,very nice work.

Thanks for the comments,

If you want, i will also post the automatic unwrapper i use (maxscript is just plain text, that once you run on maxscript editor, you add them to a menu, and they are automatically saved as mcr files on 3dsmax user`s script folder). This maxscript was also adapted by me, and it work perfectly, no errors, it automatically generates the 2nd UVW coordinates to lightmapping:

macroScript UVWLightmapping
category: “UDK Tools”
tooltip: “Add 2nd Lightmap UVW for UDK”

(

fn uvwFlattenMap objArr mapChannel:1 = if objArr.count != 0 do
(
clearSelection()
SetCommandPanelTaskMode #modify
with redraw off
(
for node in objArr where validModifier node (modifier = Unwrap_uvw()) do
(
addModifier node modifier ui:on
modifier.setMapChannel mapChannel
select node ; modPanel.setCurrentObject modifier
modifier.flattenMap 45.0 #([1,0,0], -1,0,0], [0,1,0], [0,-1,0], [0,0,1], [0,0,-1]) 0.02 on 0 on on
)
)
)
uvwFlattenMap (selection as array) mapChannel:2

)

Also this works for a multiple selection of objects

Here is another cool maxscript, again edited by me, specially usefull if you use some models imported (not modelled specifically for udk), like downloaded from turbosquid, especially models that are already triangulated. After a lot of trying, I observed that the marjority of these free models which are not UDK ready, you probally will have some problems with smoothing groups, the model will be rendered weird, specially if using render maps in UDK.

This script fix the smoothing of polygons in 3dsmax, to be correctly rendered in UDK:

macroScript UE3Smooth
category: “UDK Tools”
tooltip: “Smooth polys for UDK”
(

fn autoSmooth tresh: = if selection.count == 0 then (messageBox “Select Some Objects!” title:“Warning” beep:off) else
(
local poAS = polyop.setFaceSmoothGroup
local moAS = meshop.autosmooth
for o in selection where isKindOf o GeometryClass and not isKindOf o Targetobject do
(
if o.modifiers.count != 0 then addModifier o (smooth autosmooth:true threshold:tresh) else
(
case classof o of (
(Editable_Poly): (poAS o o.faces tresh add:false)
(Editable_Mesh): (moAS o o.faces tresh ; update o)
)
)
)
)
autoSmooth tresh:45

)

Also this works for a multiple selection of objects

About the PHP Scripts toolbox, it is not just for placement objects, it lets you edit a lot of actors properties just by using notepad++ to edit the resulting t3d file

In example, this is the template outputted from this PHP Scripts Toolbox:

Begin Map
Begin Level
Begin Actor Class=StaticMeshActor Name=StaticMeshActor_4 Archetype=StaticMeshActor’Engine.Default__StaticMeshActor’
Begin Object Class=StaticMeshComponent Name=StaticMeshComponent0 ObjName=StaticMeshComponent_6 Archetype=StaticMeshComponent’Engine.Default__StaticMeshActor:StaticMeshComponent0’
StaticMesh=StaticMesh’Test.prop001’
VertexPositionVersionNumber=1
ReplacementPrimitive=None
bAllowApproximateOcclusion=True
bForceDirectLightMap=True
bUsePrecomputedShadows=True
LightingChannels=(bInitialized=True,Static=True)
Name=‘StaticMeshComponent_6’
ObjectArchetype=StaticMeshComponent’Engine.Default__StaticMeshActor:StaticMeshComponent0’
End Object
StaticMeshComponent=StaticMeshComponent’StaticMeshComponent_6’
Components(0)=StaticMeshComponent’StaticMeshComponent_6’
Location=(X=0.000000,Y=0.000000,Z=0.000000)
CreationTime=1728.151245
Tag=‘StaticMeshActor’
CollisionComponent=StaticMeshComponent’StaticMeshComponent_6’
Name=‘StaticMeshActor_4’
ObjectArchetype=StaticMeshActor’Engine.Default__StaticMeshActor’
End Actor
End Level
Begin Surface
End Surface
End Map

Begin Map
Begin Level
Begin Actor Class=StaticMeshActor Name=StaticMeshActor_4 Archetype=StaticMeshActor’Engine.Default__StaticMeshActor’
Begin Object Class=StaticMeshComponent Name=StaticMeshComponent0 ObjName=StaticMeshComponent_6 Archetype=StaticMeshComponent’Engine.Default__StaticMeshActor:StaticMeshComponent0’
StaticMesh=StaticMesh’Test.prop002’
VertexPositionVersionNumber=1
ReplacementPrimitive=None
bAllowApproximateOcclusion=True
bForceDirectLightMap=True
bUsePrecomputedShadows=True
LightingChannels=(bInitialized=True,Static=True)
Name=‘StaticMeshComponent_6’
ObjectArchetype=StaticMeshComponent’Engine.Default__StaticMeshActor:StaticMeshComponent0’
End Object
StaticMeshComponent=StaticMeshComponent’StaticMeshComponent_6’
Components(0)=StaticMeshComponent’StaticMeshComponent_6’
Location=(X=0.000000,Y=0.000000,Z=0.000000)
CreationTime=1728.151245
Tag=‘StaticMeshActor’
CollisionComponent=StaticMeshComponent’StaticMeshComponent_6’
Name=‘StaticMeshActor_4’
ObjectArchetype=StaticMeshActor’Engine.Default__StaticMeshActor’
End Actor
End Level
Begin Surface
End Surface
End Map

So as you can see, it is the code to place the prop001 and prop002 on my map. If i want in example to change the lightmap resolution for all objects, i don`t need to go object by object and open F4 properties panel.

No i just replace some statement using notepad++, this way:

replace

LightingChannels=(bInitialized=True,Static=True)
by

bOverrideLightMapRes=True\rOverriddenLightMapRes=128\rLightingChannels=(bInitialized=True,Static=True)

The result will be:

Begin Map
Begin Level
Begin Actor Class=StaticMeshActor Name=StaticMeshActor_4 Archetype=StaticMeshActor’Engine.Default__StaticMeshActor’
Begin Object Class=StaticMeshComponent Name=StaticMeshComponent0 ObjName=StaticMeshComponent_6 Archetype=StaticMeshComponent’Engine.Default__StaticMeshActor:StaticMeshComponent0’
StaticMesh=StaticMesh’Test.prop001’
VertexPositionVersionNumber=1
ReplacementPrimitive=None
bAllowApproximateOcclusion=True
bForceDirectLightMap=True
bUsePrecomputedShadows=True
bOverrideLightMapRes=True
OverriddenLightMapRes=128
LightingChannels=(bInitialized=True,Static=True)
Name=‘StaticMeshComponent_6’
ObjectArchetype=StaticMeshComponent’Engine.Default__StaticMeshActor:StaticMeshComponent0’
End Object
StaticMeshComponent=StaticMeshComponent’StaticMeshComponent_6’
Components(0)=StaticMeshComponent’StaticMeshComponent_6’
Location=(X=0.000000,Y=0.000000,Z=0.000000)
CreationTime=1728.151245
Tag=‘StaticMeshActor’
CollisionComponent=StaticMeshComponent’StaticMeshComponent_6’
Name=‘StaticMeshActor_4’
ObjectArchetype=StaticMeshActor’Engine.Default__StaticMeshActor’
End Actor
End Level
Begin Surface
End Surface
End Map

Begin Map
Begin Level
Begin Actor Class=StaticMeshActor Name=StaticMeshActor_4 Archetype=StaticMeshActor’Engine.Default__StaticMeshActor’
Begin Object Class=StaticMeshComponent Name=StaticMeshComponent0 ObjName=StaticMeshComponent_6 Archetype=StaticMeshComponent’Engine.Default__StaticMeshActor:StaticMeshComponent0’
StaticMesh=StaticMesh’Test.prop002’
VertexPositionVersionNumber=1
ReplacementPrimitive=None
bAllowApproximateOcclusion=True
bForceDirectLightMap=True
bUsePrecomputedShadows=True
bOverrideLightMapRes=True
OverriddenLightMapRes=128
LightingChannels=(bInitialized=True,Static=True)
Name=‘StaticMeshComponent_6’
ObjectArchetype=StaticMeshComponent’Engine.Default__StaticMeshActor:StaticMeshComponent0’
End Object
StaticMeshComponent=StaticMeshComponent’StaticMeshComponent_6’
Components(0)=StaticMeshComponent’StaticMeshComponent_6’
Location=(X=0.000000,Y=0.000000,Z=0.000000)
CreationTime=1728.151245
Tag=‘StaticMeshActor’
CollisionComponent=StaticMeshComponent’StaticMeshComponent_6’
Name=‘StaticMeshActor_4’
ObjectArchetype=StaticMeshActor’Engine.Default__StaticMeshActor’
End Actor
End Level
Begin Surface
End Surface
End Map

So this trick is a time saver, a life saver, because i can, in example, set all the properties that appear on F4 Properties panel inside UDK Editor by using these text commands. Just then copy and paste this text inside UDK Viewport, and voilla!!! I editted multiple meshes at once.

Cheers

As I said above, wow, but I don’t appreciate the thread hi-jack. No I don’t use Max. I’m aware of per-poly collision which if you’d read my thread starter you should understand. Also rather than hi-jacking my thread you’d probably get more coverage by beginning your own self-publicity thread.

My original question still stands for anyone who may know an answer: Around a single mesh I get collision on import to UDK using UCX_xxx around the large collision objects of the mesh. But on smaller objects on the mesh such a 6-8uu fence the collision doesn’t appear. UDK seems to cull UCX_xxx of smaller collision objects on a mesh. Instead on the mesh for the fence I’m using UDK box collision. Larger objects of the mesh -as I’ve mentioned- have collision. Therefore my question is, is there a switch so that UDK will acknowledge smaller collision objects on a mesh?

Hey dude, i am not hi-jacking your thread :slight_smile:

I just wanted to share some information on how to export meshes to UDK and setting up collisions. And as I said before, I NEVER HAD ANY PROBLEM ON SETTING UP COLLISION FOR SMALLER OBJECTS. The collision mesh i setup using the above workflow, they work PERFECTLY, for both small, medium and big objects.

Which software you are using to create these collision models? Maybe the way you are creating the collision models is not working. Also, something VERY IMPORTANT, is that the name of your objects must not contain any special characters, underscore, and so on. I think this could be the problem.

In example, I use this naming convention:

geometry001
geometry002
geometry003
prop001
prop002

So the collision models name will be these:

UCX_geometry001
UCX_geometry002
UCX_geometry003
UCX_prop001
UCX_prop002

I am sure, i already had a similar problem before, when using, in example UCX_geometry_001, UCX_prop_001, some collision models did not show up.

Also, i only use one collision model per object. If your static mesh is big, or to complex that one collision models is not enough, you should break this mesh into smaller parts, and add one collision model for each of these parts.

I hope you can solve your problem.

Cheers.

Thanks for your extended thoughts.

As I mentioned I’m using MeshName and for the collision: UCX_MeshName. The larger UCX collision on a particular mesh is showing up in UDK but on the same mesh the smaller collision isn’t, therefore I’m using UDK blocking volumes instead for the smaller stuff on that particular mesh. For the ‘smaller stuff’ (the fence) I should probably use a single fence -as you say, as a single object- and then join the fence together - in UDK

Curious though that on a large mesh with mainly large collision UDK should ignore the smaller UCX collision objects on the mesh. As I say I’ve noticed it before and got around it by enlarging the smaller collision objects.

btw I notice problems with Physics Karma objects with skeletons/bones if they’re scaled too small. ie: the default creation of a physics item ignores smaller bones, but there’s a checkbox to allow all bones. I was wondering if there was something like that in UCX. Conclusion I think is as you said, make the fence -and smaller items generally- separately. I’ll keep the mesh as it is for now because the fence isn’t entirely a straight fence, it has a few angles. I’ll use the knowledge for later when making similar items. Thanks.

You can import your UCX collision as a different mesh and make it per-poly. Then, make it hidden in the game and disable collision for the fence mesh. Kinda dirty, but always works.

Great solution, I didn’t think of that. Thanks!

Here’s another way you can try. Attach the collision to your fence mesh and set it a new material ID like it’s an actual part of it. Assign some fake submaterial to it so it could be exported correctly. In UDK, enable per-poly collision, but disable it for all IDs except for ID with collision mesh.

Another excellent solution.

It’s all about thinking out-of-the-box, exactly what you did, and you’ve helped me with the covert learning tucked in there :slight_smile:

Thanks Avatarus

Network or singleplayer are you referring to? There are various bools that could be applied to the platform and player that may make a difference. If its a constant set of meshes, try checking distance between the player and mesh and update (or write values to log to see what they are) collision parms if the mesh gets close to ensure they are correct/what you expect (maybe a bug elsewhere that overrides what you think they are ?) e.g.



                SetCollision( true, true);
		bCollideWorld = true;
                bBlockActors = TRUE


Maybe in the component stuff like BlockRigidBody, CollideActors …

Yeah Zulu coming along nicely, just added horses which would have been easy if it was singleplayer only (horses are possessed with attached mesh as opposed to vehicle) except with MP it created all sorts of issues with replication and issues in UDK. Got it working now (not as good as I’d like but …). From the horses I can relate to the ad hoc issues you are having.

Intermittent issues are the worse …
Another thought maybe you might need to consider these properties as it might be doing something odd with the movement with both actors and not aware the other actor is at the location to collide with (hence no collision) :



	bAlwaysRelevant=true
	AlwaysRelevantDistanceSquared=1960000.0  


You say the platform is moving, does the player move inside the platform, have you thought about adding a bone so its a skel mesh. Maybe try attach to a socket if a skel mesh (mind you there are issues which I had but they can be overcome).

Other things you could try is add a Bump event, ensure bBlockActors = TRUE is set on both actors and log the bump event.

Not sure of the environment and how the player/platform interact or to other players in MP, maybe theres scope to attach the platform as an archetype to the player and move the player ? Dunno just throwing things around for some out of the box thinking …

thank you for sharing

thank you for sharing