Results 1 to 7 of 7

Thread: Spawn a static mesh

  1. #1

    Spawn a static mesh

    It sounds easy, but i can't do it : /

    This is part of my code :

          local StaticMeshComponent Cell3D;
          Cell3D=Spawn(class'StaticMeshComponent',self,,Location + Position);
    But i've got this error :
    Error, Type mismatch in Call to 'Spawn' , parameter 1

    I also tried :

          local StaticMeshActor Cell3D;
          Cell3D=Spawn(class'StaticMeshActor',self,,Location + Position);
    It worked with UT2004 but not with UDK.
    i've got : Unrecognize member 'SetStaticMesh' in class 'StaticMeshActor'

    I just want to spawn/display a staticmesh with its collision.

    The class that code is called from, extends from Info.

    Which Class do i have to spawn ?
    Why do i have "Error, Type mismatch in Call to 'Spawn' , parameter 1" ?

    thank for answer

  2. #2
    Actor subclasses are spawned.
    Object subclasses must be created with new ( )

    StaticMeshComponent is an object. It is also a component, so it needs to be attached to an actor to do anything.

  3. #3
    Ok ! good to know. Thank !

    Do you have an idea about the class to spawn ? StaticMeshcomponent ?

    So i have to spawn an Actor before in order to attach my StaticMeshcomponent isn't it ?

  4. #4
    Solid Snake
    There are many examples of attaching meshes onto other meshes / actors in the UDK source code provided. Before asking questions and waiting for answers, might I suggest you look at how it was done in the sample code provided?

  5. #5
    Ok sorry i'm a little bit in a hurry ><

    Thank a lot, i'll look at the source.

  6. #6
    Open up the weapon source and just search for Spawn. They don't all do it like you'd think, but I'm fairly sure at least one of the weapons provided does it in the manner you'd expect. Just apply how they do it to your example.

    You're calling the wrong thing to spawn at the moment, it's more along the lines of:
    URMesh = Spawn(class'MyMod.YourMesh', , '', Location);

    With the mesh definition in your defaultproperties. Just check the actual weapon code for a few weapons (how they spawn a projectile), you'll get the idea. Whizzle also has examples. You'll find that there is little patience amongst programmers (I'm not one) for really simple stuff like this. To them, it's like saying "hey can you program my stuff for me kthx". Always try a quick search, explain what you looked at, what you can't figure out; you'll get a much kinder response


  7. #7
    Thank for your post and advices Danimal.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts