stitching/combining 2 meshes into one..

All about the StoneScript

stitching/combining 2 meshes into one..

Postby 25kb » 2017-11-28 09:14

hello huys i was wondering if it is possible to stitch/combine 2 meshed in runtime, lets just say a sphere and a box. same material,texture static object no ai etc. just simple combination of the 2 so it will only use one drawcall. ive looked at some examples but the documentation has no info about this. i always look at documentations for explainations but these ones dont have any, iam by no means a beginner shiva and probably going to figure this out myself but it might take along time.iam also not sure if it will work as intended because the uv mapping might be messed up.pointing in the right direction would be usefull .thanks..
25kb
Fresh Boarder
Fresh Boarder
 
Posts: 2
Joined: 2017-11-28 08:58

Re: stitching/combining 2 meshes into one..

Postby VLens » 2017-11-28 12:28

Hey 25kb,

if both objects are created at runtime, you can use scene.combineRuntimeObjectsGroup ( hScene, hGroup )

For example:
Code: Select all
   
local hScene = application.getCurrentUserScene ( )
   
    if hScene
    then
        local hSphere = scene.createRuntimeObject ( hScene, "Model_Sphere" )
        local hBox = scene.createRuntimeObject ( hScene, "Model_Box" )
        local hTempGroup = scene.createRuntimeObject ( hScene, "" )
       
        if hSphere and hBox and hTempGroup
        then
            object.setParent ( hSphere, hTempGroup, false )
            object.setParent ( hBox, hTempGroup, false )
            local hCombinedObject = scene.combineRuntimeObjectsGroup ( hScene, hTempGroup )
            if hCombinedObject
            then
                object.setVisible ( hCombinedObject, true )
                scene.destroyRuntimeObject ( hScene, hTempGroup )
            end
        end
    end


Otherwise (non-runtime objects), you can use the mesh API, but that's much more complicated.
VLens
Expert Boarder
Expert Boarder
 
Posts: 86
Joined: 2010-03-03 16:32
Location: Hungary

Re: stitching/combining 2 meshes into one..

Postby broozar » 2017-11-28 15:49

perfect reply. just wanted to add 2 links that might be of interest to you:

http://www.shiva-engine.com/kbe_knowled ... -batching/
http://www.shiva-engine.com/kbe_knowled ... g-by-name/
User avatar
broozar
Administrator
Administrator
 
Posts: 4101
Joined: 2007-09-16 10:22
Location: Berlin - Germany

Re: stitching/combining 2 meshes into one..

Postby 25kb » 2017-11-29 02:53

thanks for the reply guys..i totally forgot about that combine group thingy was looking in the mesh api ..err i was actually looking at the mesh api samples. yep its complicated but i think im getting a hang of it.. thanks.
25kb
Fresh Boarder
Fresh Boarder
 
Posts: 2
Joined: 2017-11-28 08:58


Return to Game programming

Who is online

Users browsing this forum: No registered users and 11 guests

cron