Author Topic: Removing a named Polygon  (Read 934 times)

0 Members and 1 Guest are viewing this topic.

Offline Cloudee1

Removing a named Polygon
« on: November 25, 2015, 04:22:33 PM »
I have a named polygon created using scicompanion. As well as the other polygons which fall under the default name.

I am adding the polygons at init
Code: [Select]
  (method (init)
        AddPolygonsToRoom(@P_Default35)
        AddPolygonsToRoom(@P_SkimmerPoly)
  (super:init())

If the skimmer is gone, which corresponds to the skimmer poly, I have been unsuccessful at removing the polygon.

I tried the code from both eqoquest and kq6, which is pretty much identical. I am assuming that global2 maps to gRoom, which might be part of my problem if I am mistaken there.

Code: [Select]
(send ((send gRoom:obstacles)):delete(@P_SkimmerPoly))

I tried it with and without the @ symbol. Both ways compile fine, however the poly is ever present. Anyone have any ideas on how to accomplish the removal of the polygon generated by companion and housed in the shp file. I should be able to take it out of the shp file and actually code it to an instance of poly and try again, which I will probably do for testing, but that loses the ease of use that Troflip built into scicompanion for working with the polygons. So I would rather not make that plan a


Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline troflip

Re: Removing a named Polygon
« Reply #1 on: November 25, 2015, 04:36:57 PM »
obstacles deals with polygon objects, not buffers of polygon points. So you need to do something like:

Code: [Select]
(local
    shipPolygon
)


Code: [Select]
(method (init)
    // Stash it off so we can remove it later:
    (= shipPolygon CreateNewPolygon(@P_SkimmerPoly))
    // Add it:
    (send gRoom:addObstacle(shipPolygon))
)

Then when you want to remove it:

Code: [Select]
(send (send gRoom:obstacles):delete(shipPolygon))
« Last Edit: November 25, 2015, 04:38:31 PM by troflip »
Check out my website: http://icefallgames.com
Groundhog Day Competition


SMF 2.0.14 | SMF © 2017, Simple Machines
Simple Audio Video Embedder

Page created in 0.098 seconds with 22 queries.