About Store Forum Documentation Contact



Post Reply 
[Solved] Actor
Author Message
Harry Offline
Member

Post: #1
[Solved] Actor
In my struct which based on Items I create new actor:

carP.load("Obj/Pojazdy i helikopter/Radiowoz/Nadwozie.phys");
carA.create(carP);
carA.pos(pos());

But now I've got problems because I draw mesh:

case RM_SOLID:
carM.draw(carA.matrix());

and when other cars aren't in my view range mesh dissapear. Except that I've got actors which I add in .obj file in WE. They are near new created actors and I collide wiht them. When I delete them by actor.del(); or delete in .obj file my actor and mesh doesn't create. Why I have these problems?
(This post was last modified: 02-14-2011 11:29 AM by Harry.)
11-28-2009 03:53 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #2
RE: Actor
you need to handle properly 'save' 'load' methods

save the path to physical body (f.putStr(Physs(phys_ptr)))
save actor data actor.save(f);

when loading, load physical body if(phys_ptr=Physs(f.getStr())) and create actor.create(*phys_ptr)
and load actor data actor.load(f)
11-28-2009 05:11 PM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #3
RE: Actor
I made this:
Code:
void policeCar::save(EE::File &f)
{
    f.putStr(Physs(carP));
    carA.saveState(f);
}
Bool policeCar::load(EE::File &f)
{
    if(__super::load(f)) // if default load was successful
    {
        if(carP=Physs(f.getStr()))carA.create(*carP);
        return true;    // return success
    }
    return false;
}
but nothing change.
11-28-2009 07:15 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #4
RE: Actor
you forgot actor::loadState
11-28-2009 08:15 PM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #5
RE: Actor
Still the same :( Mesh still disappear when another objects is for example behind me.

EDIT: Objects with the same type.
(This post was last modified: 11-28-2009 11:43 PM by Harry.)
11-28-2009 10:20 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #6
RE: Actor
http://img504.imageshack.us/img504/2056/errf.jpg

What does this error means? Why possibly I got it?
11-29-2009 04:00 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #7
RE: Actor
incorrect saving/loading? its just a guess. you have an error somewhere
11-29-2009 05:07 PM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #8
RE: Actor
When I'm saving mesh should I save path too? Or only put mesh.save(f); ? What should I save and load? All floats and integers variables? Or something else too.
11-30-2009 02:25 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #9
RE: Actor
only path needs to be saved (in mesh)

you should save everything that you have in your custom class
11-30-2009 03:43 PM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #10
RE: Actor
Unhandled exception at 0x0054f74b in Tutorials.exe: 0xC0000005: Access violation reading location 0x00000000. I've got this error and arrow on this line Ptr validElm(Int i){return absElm(valid[i]);} in struct _Memx

when i'm trying to load my world. Why it could be? I kow that it's with my members but in BM I don't see that they are aving or loading.
(This post was last modified: 11-30-2009 05:17 PM by Harry.)
11-30-2009 05:13 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #11
RE: Actor
Sholud I load in ::Load(File f) all paths to files like particles, sounds, meshs, actors which I load mannually in constructor? Can I make it like in BM (SaveNonSavedParemeters() function)?
(This post was last modified: 12-02-2009 03:44 PM by Harry.)
12-02-2009 03:44 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #12
RE: Actor
yes, you can use SetNonSavedParemeters, its up to you
12-02-2009 04:26 PM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #13
RE: Actor
How can I save Wheels? I must create it again? I have saved only wheels mesh paths but when I load game wheels are deleted.
12-03-2009 02:27 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #14
RE: Actor
currently you must re-create them after loading the car actor
12-03-2009 04:39 PM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #15
RE: Actor
When I do this and load game i have this:

http://img204.imageshack.us/img204/209/scrsh.jpg

I create whells by this code: wheel[0].create(actor,Matrix().setPos(actor.pos()+Vec( 1,-0.7, 1.9)),wp); // left -front

Maybe you know why?
(This post was last modified: 12-03-2009 07:12 PM by Harry.)
12-03-2009 07:12 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply