Rocket-Ticket Questionthread (... haha)
Moderator: PPS-Leaders
Re: Rocket-Ticket Questionthread (... haha)
i assume the rocket gets destroyed if it hits something, but it doesn't delete the controller. so when the controller tries to delete the rocket, the pointer isn't valid anymore. so you probably have to delete the controller in the destructor of SimpleRocket.
i know it's a mess, because there's usually a player associated to a controllable entity which manages both controller and the entity. but in this case there's no player, so we need some workarounds
i don't know why the rocket isn't visible. maybe it gets destroyed right after it spawns? add some debug output to the constructor and the destructor of simplerocket, so you can see when it gets created and destroyed.
i know it's a mess, because there's usually a player associated to a controllable entity which manages both controller and the entity. but in this case there's no player, so we need some workarounds
i don't know why the rocket isn't visible. maybe it gets destroyed right after it spawns? add some debug output to the constructor and the destructor of simplerocket, so you can see when it gets created and destroyed.
Fabian 'x3n' Landau, Orxonox developer
Re: Rocket-Ticket Questionthread (... haha)
ah that with the output is a good idea, why didn't I think of this?
If I try to destroy the controller of the simplerocket in the destructor of the simplerocket (delete this->getController()) then orxonox cannot start, it seems to destroy one SimpleRocket while starting...
again i've attached a screenshot and committed this version.
If I try to destroy the controller of the simplerocket in the destructor of the simplerocket (delete this->getController()) then orxonox cannot start, it seems to destroy one SimpleRocket while starting...
again i've attached a screenshot and committed this version.
- Attachments
-
- At this point orxonox fails to continue and freezes.
- orxonox_fail_002.JPG (86.25 KiB) Viewed 15802 times
Re: Rocket-Ticket Questionthread (... haha)
this is probably because of the factory creation (mentioned in the introduction). you need to check whether the controller is 0 or not and (in the ctor of the rocket) set the ctroller pointer to 0 by default
something like this
also: i saw that you do delete this in the RocketController destructor. this is always a bad idea and probably just a mistake
Code: Select all
if( this->controller_ ) delete this->controller_
also: i saw that you do delete this in the RocketController destructor. this is always a bad idea and probably just a mistake
There are only 10 types of people in the world: Those who understand binary, and those who don't.
Re: Rocket-Ticket Questionthread (... haha)
ah yes I wanted to use something like
but it tells me I cannot access this private variable.
I used
but Orxonox still crashes while starting...
Code: Select all
if( this->controller_ ) delete this->controller_
I used
Code: Select all
if (this->hasLocalController()) delete this->getController();
Re: Rocket-Ticket Questionthread (... haha)
yes, orxonox creates and destroys one instance of each object on startup. however the constructor stops at RegisterObject(...), so you can't initialize your object.
try this in the destructor:
isInitialized() is an inherited function from BaseObject
try this in the destructor:
Code: Select all
SimpleRocket::~SimpleRocket()
{
if (this->isInitialized())
{
COUT(0)<< "simplerocket destroyed\n";
delete this->getController();
}
}
Fabian 'x3n' Landau, Orxonox developer
Re: Rocket-Ticket Questionthread (... haha)
ah now Orxonox can start again.
but the rocket still isn't visible after constructing it (controller as well as rocket get successfully constructed as well as destroyed when going back to the mainmenu.
but the rocket still isn't visible after constructing it (controller as well as rocket get successfully constructed as well as destroyed when going back to the mainmenu.
Re: Rocket-Ticket Questionthread (... haha)
i made some changes and the rocket is visible now
however the "spawnpoint", the velocity and the scaling are still wrong
had to change setMeshSource("Rocket.mesh") to "rocket.mesh" but i think this was not a problem on windows
however the "spawnpoint", the velocity and the scaling are still wrong
had to change setMeshSource("Rocket.mesh") to "rocket.mesh" but i think this was not a problem on windows
There are only 10 types of people in the world: Those who understand binary, and those who don't.
Re: Rocket-Ticket Questionthread (... haha)
cool. For me up to now the important thing has been to get the rocket to spawn. Now that that works I hope I can progress faster
thank you very much
thank you very much
Re: Rocket-Ticket Questionthread (... haha)
okay the first step is done. The rocket spawns near the spaceship.
I'll post again if I get stuck (and I'm sure I will ...)
thanks again
I'll post again if I get stuck (and I'm sure I will ...)
thanks again
Re: Rocket-Ticket Questionthread (... haha)
Ok I ran into the next problem.
When i invoke "destroy()" from the Simplerocket (or from the rocketcontroller) orxonox crashes.
If I don't invoke destroy() the rocket doesn't get destructed even though it crashes with things (e.g. a drone) and explodes.
When i invoke "destroy()" from the Simplerocket (or from the rocketcontroller) orxonox crashes.
If I don't invoke destroy() the rocket doesn't get destructed even though it crashes with things (e.g. a drone) and explodes.
Re: Rocket-Ticket Questionthread (... haha)
without a backtrace (orxonox_crash.log) it's hard to say, but do you have any references to the rocketcontroller (not in the simplerocket) which are invalid when you destroy the rocket (and also the controller) ?
There are only 10 types of people in the world: Those who understand binary, and those who don't.
Re: Rocket-Ticket Questionthread (... haha)
hmm I can't find this file... (orxonox_crash.log).
Right now I am looking for references to the controller.
When I construct the controller in the function SimpleRocketFire.fire() I use a pointer but this pointer isn't existing anymore later is it? (I'm a bit confused )
Right now I am looking for references to the controller.
When I construct the controller in the function SimpleRocketFire.fire() I use a pointer but this pointer isn't existing anymore later is it? (I'm a bit confused )
Re: Rocket-Ticket Questionthread (... haha)
the file is in build/log/orxonox_crash.log
about the pointer it depends. as long as you don't delete (or destroy) the controller the pointer is valid, or what exactly do you mean?
about the pointer it depends. as long as you don't delete (or destroy) the controller the pointer is valid, or what exactly do you mean?
There are only 10 types of people in the world: Those who understand binary, and those who don't.
Re: Rocket-Ticket Questionthread (... haha)
the file doesn't exist on windows. on linux, see greenmans post.
i suggest to visit us in the PPS tomorrow, this makes it easier for us to reproduce and debug the problem.
i suggest to visit us in the PPS tomorrow, this makes it easier for us to reproduce and debug the problem.
Fabian 'x3n' Landau, Orxonox developer
Re: Rocket-Ticket Questionthread (... haha)
fixed a problem with the rocket
it successfully collides against an asteroid now (not yet tested with bots)
it successfully collides against an asteroid now (not yet tested with bots)
There are only 10 types of people in the world: Those who understand binary, and those who don't.
Who is online
Users browsing this forum: No registered users and 5 guests