<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://pybullet.org/Bullet/phpBB3/app.php/feed/topic/472" />

	<title>Real-Time Physics Simulation Forum</title>
	
	<link href="https://pybullet.org/Bullet/phpBB3/index.php" />
	<updated>2006-08-18T06:55:42+00:00</updated>

	<author><name><![CDATA[Real-Time Physics Simulation Forum]]></name></author>
	<id>https://pybullet.org/Bullet/phpBB3/app.php/feed/topic/472</id>

		<entry>
		<author><name><![CDATA[duarte]]></name></author>
		<updated>2006-08-18T06:55:42+00:00</updated>

		<published>2006-08-18T06:55:42+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=1541#p1541</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=1541#p1541"/>
		<title type="html"><![CDATA[infinite loop in collision detection]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=1541#p1541"><![CDATA[
Is there a way to freeze an object in blender?<br><br>Here?s why I think my script gets into an infinite loop:<br><br>When I change the "oxigenio"'s attribute, the GE detects another collision, because it "thinks" "oxigenio" is another object, so it changes the atribute again...and so on..and so on...still, i really need to have this attributes within the object...<br><br>    import Blender<br>    import GameLogic<br><br>    #get actuator<br>    collision_actuator = GameLogic.getCurrentController().getActuator("wall_x_act")<br><br>    #get object's velocity components<br>    vx = Blender.Object.Get("oxigenio").getProperty("vx").getData()<br>    vy = Blender.Object.Get("oxigenio").getProperty("vy").getData()<br>    vz = Blender.Object.Get("oxigenio").getProperty("vz").getData()<br>   <br>    #change object's vx<br>    Blender.Object.Get("oxigenio").getProperty("vx").setData(-vx)<br><br>    #change vx component<br>    collision_actuator.setLinearVelocity(-vx,vy,vz,False)<br>    GameLogic.addActiveActuator(collision_actuator,True)<br><br><br><br><br><br>i?ve tried to solve this using a decorator, but it?s not working:<br><br><br>import Blender<br>import GameEngine<br><br><br>def locked(meth):<br>   meth.locked = False<br>   def wrapper(*args, **kwargs):<br>       if meth.locked:<br>           return<br>       meth.locked = True<br>       ret = meth(*args, **kwargs)<br>       meth.locked = False<br>       return ret<br>   return wrapper<br><br><br>@locked<br>def collision_handler():<br>   <br>    #get actuator<br>    collision_actuator = GameLogic.getCurrentController().getActuator("wall_x_act")<br><br>    #get object's velocity components<br>    vx = Blender.Object.Get("oxigenio").getProperty("vx").getData()<br>    vy = Blender.Object.Get("oxigenio").getProperty("vy").getData()<br>    vz = Blender.Object.Get("oxigenio").getProperty("vz").getData()<br>   <br>    #change object's vx<br>    Blender.Object.Get("oxigenio").getProperty("vx").setData(-vx)<br><br>    #change vx component<br>    collision_actuator.setLinearVelocity(-vx,vy,vz,False)<br>    GameLogic.addActiveActuator(collision_actuator,True)<br><br><br>collision_handler()<br><br><br><br><br>Can the GE solve this problem in some way?<br>Do I have to include an atribute "locked" in the objects attributes, so that it can?t collide twice with the same wall?<br><br>please post a link if you know where i can find more information..i?ve searched everywhere...<br><br>thanks in advance<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=740">duarte</a> — Fri Aug 18, 2006 6:55 am</p><hr />
]]></content>
	</entry>
	</feed>
