Jump to content

Updating collison after running a SetScale function


AlexxEG

Recommended Posts

So I have this to increase/decrease safes size in my mod. It scales correct, but the collison dosen't update without me doing "Disable" then "Enable" in console. I tryed to but that in the script but dosen't work.

 

Here is the (not full) code: BTW: I didn't use the GetSelf function at first, it was just a attempt to fix this problem.

elseif ( Button == 3 )
		Set rSelf to GetSelf
		Set sSize to ( GetScale + 0.2 )
		rSelf.SetScale sSize
		rSelf.Disable
		rSelf.Enable
	elseif ( Button == 4 )
		Set rSelf to GetSelf
		Set sSize to ( GetScale - 0.2 )
		rSelf.SetScale sSize
		rSelf.Disable
		rSelf.Enable

 

Does anyone know how to make it update? Thanks in advance!^^

Link to comment
Share on other sites

I believe if you wait a frame between the Disable and Enable commands it will work. One suggestion would be to use a flag variable to make it Enable on the next script iteration. It's hard to give a specific example without seeing your whole script, but instead of calling Enable do this:

 

set bEnableMe to 1

 

...then somewhere before that in the script (might as well be the first thing), in a GameMode block:

 

	if bEnableMe
	Enable 0
	set bEnableMe to 0
	Return
endif

Link to comment
Share on other sites

No problem. :thumbsup: I had to do that often enough in Feng Shui that I made a dedicated "CollisionFix" object whose sole purpose is to do that when needed for any given object.
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...