Harry
Member
|
[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 |
|
Esenthel
Administrator
|
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 |
|
Harry
Member
|
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 |
|
Esenthel
Administrator
|
RE: Actor
you forgot actor::loadState
|
|
11-28-2009 08:15 PM |
|
Harry
Member
|
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 |
|
Harry
Member
|
|
11-29-2009 04:00 PM |
|
Esenthel
Administrator
|
RE: Actor
incorrect saving/loading? its just a guess. you have an error somewhere
|
|
11-29-2009 05:07 PM |
|
Harry
Member
|
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 |
|
Esenthel
Administrator
|
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 |
|
Harry
Member
|
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 |
|
Harry
Member
|
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 |
|
Esenthel
Administrator
|
RE: Actor
yes, you can use SetNonSavedParemeters, its up to you
|
|
12-02-2009 04:26 PM |
|
Harry
Member
|
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 |
|
Esenthel
Administrator
|
RE: Actor
currently you must re-create them after loading the car actor
|
|
12-03-2009 04:39 PM |
|
Harry
Member
|
RE: Actor
(This post was last modified: 12-03-2009 07:12 PM by Harry.)
|
|
12-03-2009 07:12 PM |
|