About Store Forum Documentation Contact



Post Reply 
CSG
Author Message
Brainache Offline
Member

Post: #16
RE: CSG
If you do CSG subtraction with both meshes being the same.. the result would be.. nothing... a blank mesh...
03-04-2010 08:06 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #17
RE: CSG
Hmmm i didn't know that, ill check that out ty smile

There is always evil somewhere, you just have to look for it properly.
03-04-2010 08:24 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #18
RE: CSG
Ok i have that now working only problem ive left:

1 wall
1 barrel

Cgs function, there is now a hole in the wall but inside the hole, the wall gets the texture from the barrel. How can i fix that?

There is always evil somewhere, you just have to look for it properly.
(This post was last modified: 03-05-2010 06:44 PM by Dynad.)
03-04-2010 11:33 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #19
RE: CSG
you can set different material for the barrel before performing csg
03-04-2010 11:35 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #20
RE: CSG
Well i tried that but the funny thing is, the barrel itself changes but the texture on the wall not.

There is always evil somewhere, you just have to look for it properly.
(This post was last modified: 03-05-2010 12:20 AM by Dynad.)
03-04-2010 11:59 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #21
RE: CSG
are you calling 'setMaterial' before Csg ?
03-05-2010 01:04 AM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #22
RE: CSG
Yes thats it smile

There is always evil somewhere, you just have to look for it properly.
03-05-2010 06:29 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #23
RE: CSG
does this mean that the problem is solved?
03-05-2010 11:26 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #24
RE: CSG
yes it works now, but i have another question. When i use the csg on 2 objects, the first object cuts always in the middle of the other object... is that because i made those 2 objects game Items?

setPos or set matrix doesn't work, only the object itself moves, but the hole in the other object is still there even it doesn't hit each other.(first object makes always a hole in precisely in the middle of the other object)

There is always evil somewhere, you just have to look for it properly.
03-06-2010 12:35 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #25
RE: CSG
you can transform mesh with mesh methods
03-06-2010 01:35 AM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #26
RE: CSG
I have tried that, i am using the setMatrix to move the object, but the problem is that the matrix moves the whole world and not just only the item.

So everytime i click, the item(barrel) moves further away.

PHP Code:
    void createDefault()
    {
        
Game::ObjParams &barrel = *Game::Objs("obj/item/misc/barrel/0.obj");
        
Game::World.objCreate(barrel,Matrix(barrel.scale(),Vec(0,0,0)));

        
__super::create(barrel);
    } 

PHP Code:
// calculate world position and direction vectors
Vec     posdirScreenToPosDir(Vec2(0,0),pos,dir);
PhysHit phys_hit; if(Physics.ray(pos,dir*ViewportActive.range,&phys_hit)) // if ray test hit an actor
    
{
        if(
phys_hit.obj// if the actor comes from an object
        
{
            if(
Game::Item *item=CAST(Game::Item,phys_hit.obj)) // if the object is an item
    
{
coord phys_hit.plane.pos;

Items.New().createDefault();
Items.absElm(Items.absElms()-1).actor.gravity(false);
Items.absElm(Items.absElms()-1).actor.collision(false);
Items.absElm(Items.absElms()-1).lod = &Items.absElm(Items.absElms()-1).mesh->createLod(1);
Items.absElm(Items.absElms()-1).lod->scale(Vec(1,1,1));
wall.lod = &wall.mesh->createLod(1);
Items.absElm(Items.absElms()-1).lod->setMaterial(Materials("../data/mtrl/brick/0.mtrl"),0).setRender();
                         
Items.absElm(Items.absElms()-1).lod->transform(Matrix(coord));
//Items.absElm(Items.absElms()-1).actor.pos(coord);
//Items.absElm(Items.absElms()-1).mesh->transform(Matrix(coord));
//Items.absElm(Items.absElms()-1).mesh->setNormals();

Csg(*wall.lod,*Items.absElm(Items.absElms()-1).lod,SEL_SUB,NULL);
wall.lod->setRender();

 
//Items.removeAbs(Items.absElms()-1);

}


There is always evil somewhere, you just have to look for it properly.
(This post was last modified: 03-06-2010 06:12 PM by Dynad.)
03-06-2010 06:11 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #27
RE: CSG
Mesh::transform
you can use temporary meshes just for Csg
03-06-2010 08:59 PM
Find all posts by this user Quote this message in a reply
Post Reply