Results 1 to 7 of 7
  1. #1

    Smile Multiple (StaticMeshComponent)s per Actor?

    Hello!

    For quite some time I have been searching for the UnrealText representation of 2 or more static mesh components governed by a single actor. I was able to synthesize my own UnrealText sample of this, shown below:

    Code:
    Begin Map
       Begin Level NAME=PersistentLevel
          Begin Actor Class=StaticMeshActor Name=StaticMeshActor_3 Archetype=StaticMeshActor'Engine.Default__StaticMeshActor'
             Begin Object Class=StaticMeshComponent Name=StaticMeshComponent0 ObjName=StaticMeshComponent_2 Archetype=InstancedStaticMeshComponent'Engine.Default__StaticMeshActor:StaticMeshComponent0'
                StaticMesh=StaticMesh'UI_CharPortraits.Mesh.S_UI_CharPortraits_Cube'
                Translation=(X=500.000000,Y=0.000000,Z=0.000000)
             End Object
             Begin Object Class=StaticMeshComponent Name=StaticMeshComponent1 ObjName=StaticMeshComponent_3 Archetype=InstancedStaticMeshComponent'Engine.Default__StaticMeshActor:StaticMeshComponent1'
                StaticMesh=StaticMesh'UI_CharPortraits.Mesh.S_UI_CharPortraits_Cube'
                Translation=(X=0.000000,Y=0.000000,Z=0.000000)
             End Object
             Components(0)=StaticMeshComponent'StaticMeshComponent_2'
             Components(1)=StaticMeshComponent'StaticMeshComponent_3'
             Tag="StaticMeshActor"
             Location=(X=-48.000000,Y=256.000000,Z=32.000000)
             DrawScale3D=(X=0.375000,Y=0.375000,Z=0.250000)
             Name="StaticMeshActor_3"
             ObjectArchetype=StaticMeshActor'Engine.Default__StaticMeshActor'
          End Actor
       End Level
    Begin Surface
    End Surface
    End Map
    If you import this as a *.t3d file into the UT3 editor, then it will result in an actor which has 2 static mesh components visible on screen. However, when this is built it only builds a single static mesh component within the actor.

    I have seen other forum posts which hint at the possibility of using multiple static meshes per actor, but none seem to give any examples of proper syntax:

    http://forums.epicgames.com/threads/...ent-how-to-use

    Does anybody know how to create an actor with multiple static mesh components? If so, then I would love to see an UnrealText (*.t3d export) of this actor. Ordinarily I would not care if it was possible to store more than 1 static mesh component per actor, but this really saves on hard drive space and render/build time when you're working on the order of several million static mesh components. Thank you for reading!

  2. #2

    Default

    - i count 3 -
    not 2


    - go into your properties and add a static mesh component-
    e.g
    StaticMesh'UN_SimpleMeshes.TexPropCube_Dup'
    or do it with your code;

    - without a static mesh component- ur object will be invisible- [effectively making it a null reference]

    -edit:
    you may need a light environment for it aswel; like how a weapon works

    - prefabs
    http://wiki.beyondunreal.com/UE3:Prefab_(UT3)
    Last edited by TKBS; 06-29-2012 at 01:58 PM.

  3. #3

    Default

    Thank you for your reply, TKBS! I'm a little unclear about the following, though:

    Quote Originally Posted by TKBS View Post
    - go into your properties and add a static mesh component-
    e.g
    StaticMesh'UN_SimpleMeshes.TexPropCube_Dup'
    or do it with your code;
    Are you talking about right clicking the StaticMeshActor and selecting "StaticMeshActor Properties"? I can't seem to get any functionality out of that menu. I can add a StaticMeshActor from the Generic window (under Static Mesh --> UN_SimpleMeshes --> TexPropCube_Dup), but this only results in creating a 2nd actor apart from the parent actor.

    Just to be clear, the code in my first post can be pasted directly into the UT3 editor and it will show 2 static mesh components as a part of a single parent actor. However, once built the engine does not save or render 2nd static mesh. This is very confusing to me.

    If it's possible to add a static mesh as a part of a parent actor in the editor, then that would be awesome. Do you know if that is possible?

  4. #4

    Default

    * in my original post i had put your code into my ut3 editor;
    * Click build all- and you get 3 errors; relating to 3 static mesh. ...Not 2
    * i then chose the actors from the "map error list" and pasted this.

    StaticMesh'UN_SimpleMeshes.TexPropCube_Dup'
    - into the properties of the 3rd mesh.


    - the other 2 mesh correspond to your "1 mesh = 2 actors thing" - these have accept lights; but in no light environment.

    - rebuild again and your left with only 2 errors [accept lights blah bl;ah b;ah]

    - i was not offering a fix as such; but when you build all- it clearly shows 3 errors; not 2
    - which means you have to add a static mesh component to the third- or you will never see it; and the engine will believe it is null [no collision; no action; no actor= no effect]

    - there is a way where you can have 2 actors for ummm 1 actor- if that makes sense.
    - but you would require some form of code like weapons/ projectiles collision; maybe skeletal mesh or collision components.

    - there is a post ...
    * that shows somthing like this [but not exactly this ]....1 actor [a cube] with another actor [a sphere] as the collision; but the editor reads it as 1 actor. [maybe using a UCX ?]
    - i have been trying to find it for you. it relates to weapons
    Last edited by TKBS; 07-01-2012 at 11:23 AM.

  5. #5

    Default

    Ah yes. You are correct. Here is an updated code sample which gives 0 errors upon build:

    Code:
    Begin Map
       Begin Level NAME=PersistentLevel
          Begin Actor Class=StaticMeshActor Name=StaticMeshActor_0 Archetype=StaticMeshActor'Engine.Default__StaticMeshActor'
             Begin Object Class=StaticMeshComponent Name=StaticMeshComponent_0 ObjName=StaticMeshComponent_0 Archetype=StaticMeshComponent'Engine.Default__StaticMeshActor:StaticMeshComponent0'
                StaticMesh=StaticMesh'UN_SimpleMeshes.TexPropCube_Dup'
                Translation=(X=500.000000,Y=0.000000,Z=0.000000)
             End Object
             Begin Object Class=StaticMeshComponent Name=StaticMeshComponent_1 ObjName=StaticMeshComponent_1 Archetype=StaticMeshComponent'Engine.Default__StaticMeshActor:StaticMeshComponent1'
                StaticMesh=StaticMesh'UN_SimpleMeshes.TexPropCube_Dup'
                Translation=(X=0.000000,Y=0.000000,Z=0.000000)
             End Object
             Components.Add(StaticMeshComponent_0)
             Components.Add(StaticMeshComponent_1)
             Tag="StaticMeshActor"
             Location=(X=-48.000000,Y=256.000000,Z=32.000000)
             DrawScale3D=(X=0.375000,Y=0.375000,Z=0.250000)
             Name="StaticMeshActor_0"
             ObjectArchetype=StaticMeshActor'Engine.Default__StaticMeshActor'
          End Actor
       End Level
    Begin Surface
    End Surface
    End Map
    This still yields just 1 of 2 expected cubes in game, but both cubes appear in the UT3 editor.
    Last edited by tch88; 07-04-2012 at 07:49 PM. Reason: Edited for clarity.

  6. #6

    Default

    I have created a solution to my problem via use of custom Actor classes. It's very simple to do. Here's the steps I used, in case anyone else wants to create efficient arrays of static meshes:

    1. Go to Documents\My Games\Unreal Tournament 3\UTGame\Src and create the following folders:
    "TestPackage" (within Src)
    "Classes" (within TestPackage)
    2. Go to Documents\My Games\Unreal Tournament 3\UTGame\Src\TestPackage\Classes and create the following file:
    MyFirstActor.uc
    3. Within this file (using a text editor like NotePad or NotePad++), paste the following code:
    Code:
    class MyFirstActor extends StaticMeshActorBase placeable;
    
    defaultproperties
    {
    	Begin Object Class=StaticMeshComponent Name=StaticMeshComponent_0 ObjName=StaticMeshComponent_0 Archetype=StaticMeshComponent'Engine.Default__StaticMeshActor:StaticMeshComponent0'
    		bAcceptsLights=True
    		StaticMesh=StaticMesh'UN_SimpleMeshes.TexPropCube_Dup'
    		Translation=(X=500.000000,Y=0.000000,Z=0.000000)
    	End Object
    	Begin Object Class=StaticMeshComponent Name=StaticMeshComponent_1 ObjName=StaticMeshComponent_1 Archetype=StaticMeshComponent'Engine.Default__StaticMeshActor:StaticMeshComponent1'
    		bAcceptsLights=True
    		StaticMesh=StaticMesh'UN_SimpleMeshes.TexPropCube_Dup'
    		Translation=(X=0.000000,Y=0.000000,Z=0.000000)
    	End Object
    	Components.Add(StaticMeshComponent_0)
    	Components.Add(StaticMeshComponent_1)
    }
    4. Go to Documents\My Games\Unreal Tournament 3\UTGame and create a shortcut to the UT3 game.
    5. Retitle this shortcut "UT3 Make"
    6. Right click this shortcut, and go to Properties
    7. At the end of the "Target:" field, add a space, and then type "make" without quotes
    8. Click "Apply"/"OK"
    9. Run the shortcut - a command line interface should appear, and within a few seconds some green text should indicate that the operation completed successfully with no errors/warnings
    10. Go to the UT3 editor and go to "View ---> Actor Classes"
    11. Scroll down to StaticMeshActorBase and select "MyFirstActor"
    12. Go to the editor window and right click the brush in the 3D perspective view and click "Add MyFirstActor Here"
    13. Enjoy your new, efficient Static Mesh Actor!

    EDIT: I've been able to throw thousands of StaticMeshComponents into single Actors with this approach, and it seems that the associated overhead and engine performance has increased significantly.

  7. #7

    Default

    i must admit i got side-tracked, forgot about this, then got rid of my pc.
    ^^ sorry about that
    - I think its great you got it working & fantastic that you came back to the thread with a solution.
    - Glad you solved it

    ** Now you can change the thread title to "Multiple (StaticMeshComponent)s per Actor? [SOLVED]"


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.