Results 1 to 7 of 7
  1. #1
    Skaarj
    Join Date
    Nov 2009
    Location
    France
    Posts
    14

    Default Spawn a static mesh

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

    This is part of my code :

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

    I also tried :

    Code:
          local StaticMeshActor Cell3D;
    
          Cell3D=Spawn(class'StaticMeshActor',self,,Location + Position);
          Cell3D.SetStaticMesh(Meshes);
    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
    Redeemer
    Join Date
    Nov 2007
    Posts
    1,207

    Default

    Actor subclasses are spawned.
    Object subclasses must be created with new ( http://udn.epicgames.com/Three/Unrea...ting%20objects )

    StaticMeshComponent is an object. It is also a component, so it needs to be attached to an actor to do anything.
    Nightblade, a stealth based total conversion for UT3

  3. #3
    Skaarj
    Join Date
    Nov 2009
    Location
    France
    Posts
    14

    Default

    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 ?
    Last edited by Kushulain; 11-21-2009 at 05:34 PM.

  4. #4
    Palace Guard

    Join Date
    Jun 2007
    Location
    Christchurch
    Posts
    3,781

    Default

    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
    Skaarj
    Join Date
    Nov 2009
    Location
    France
    Posts
    14

    Default

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

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

  6. #6
    Redeemer
    Join Date
    Mar 2009
    Posts
    1,051

    Default

    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

    danimal
    Last edited by danimal'; 11-21-2009 at 07:43 PM.

  7. #7
    Skaarj
    Join Date
    Nov 2009
    Location
    France
    Posts
    14

    Default

    Thank for your post and advices Danimal.


 

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.