FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

removeStaticShape Work?

 
Post new topic   Reply to topic     Forum Index -> Blaze
View previous topic :: View next topic  
Author Message
mike



Joined: 28 Dec 2008
Posts: 34

PostPosted: Sun Dec 28, 2008 8:09 pm    Post subject: removeStaticShape Work? Reply with quote

I created a static shape and eventually during the simulation i want to remove it so i call space.removeStaticShape(shape) but the static shape is still there in the simulation.

In the documentation it says

void removeStaticShape (GeometricShape shape);
Remove shape from simulation

Do i have to call something else with that?

Im using the rc1phobos version.
Back to top
View user's profile Send private message
mike



Joined: 28 Dec 2008
Posts: 34

PostPosted: Mon Dec 29, 2008 8:35 pm    Post subject: Reply with quote

Ok maybe it does work if i do removeStaticShape(space.shapes[0]); but i found that it will just delete all the static shapes not just one of them.
Back to top
View user's profile Send private message
mike



Joined: 28 Dec 2008
Posts: 34

PostPosted: Tue Dec 30, 2008 12:39 pm    Post subject: Reply with quote

Ok this is my last post, i got a solution. Im still new to learning D so im not sure if theres an easier way. All i know is that an array.remove doesnt seem to remove the object from the array at least for me.

Heres my solution


I did have some code here but i have found out that all you would to need to add is
Code:
shapes.length = shapes.length-1;
at the end of the function. I found that array.remove will put the element you wanted to remove to the end of the array but it will not change the length of the array causing all the shapes to still be there.
Back to top
View user's profile Send private message
brianguertin



Joined: 26 Dec 2008
Posts: 8

PostPosted: Tue Jan 06, 2009 1:42 pm    Post subject: Reply with quote

array.remove? i didnt think there was a standard function for that. I always use my own.
Back to top
View user's profile Send private message
mike



Joined: 28 Dec 2008
Posts: 34

PostPosted: Tue Jan 06, 2009 4:54 pm    Post subject: Reply with quote

Yeah. Its a nice add.

Its just like int myarray[4] = [1,2,3,4];

myarray.remove(1);

and that will remove the variable 1 from the list, well at least put it at the end of the array so it would look like [2,3,4,1] but then you can just easily change the length of the array to get rid of the variable one.
Back to top
View user's profile Send private message
SirAlaran



Joined: 19 Feb 2007
Posts: 84
Location: Silicon Valley

PostPosted: Thu Jan 08, 2009 2:27 pm    Post subject: Reply with quote

brianguertin wrote:
array.remove? i didnt think there was a standard function for that. I always use my own.


There isn't a standard function for that. I think that the array removal stuff was in there because Mason was using Tango. When I ported Blaze to Phobos I wrote my own version of that function, but I think it was made obsolete in the newer versions of Blaze.

Tango's array documentation:
http://dsource.org/projects/tango/docs/current/tango.core.Array.html
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Blaze All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group