Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'elif': 0.04; 'modified': 0.05; 'url:launchpad': 0.05; '(0,': 0.09; '0.1': 0.09; 'pressing': 0.09; 'segfault.': 0.09; 'unpacking': 0.09; 'def': 0.10; '0):': 0.16; '0.001': 0.16; 'accelerates': 0.16; 'angle': 0.16; 'crashes': 0.16; 'from:addr:swing.be': 0.16; 'from:addr:vincent.vandevyvre': 0.16; 'from:name:vincent vande vyvre': 0.16; 'message-id:@swing.be': 0.16; 'oqapy': 0.16; 'paqager': 0.16; 'received:mobistar.be': 0.16; 'url:oqapy': 0.16; 'url:paqager': 0.16; 'url:qarte': 0.16; 'v.v.': 0.16; '\xe9crit': 0.16; 'changes': 0.20; 'subject:problem': 0.22; 'work.': 0.23; 'seems': 0.23; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'reset': 0.29; "skip:' 10": 0.30; 'up.': 0.31; 'code': 0.31; 'skip:- 30': 0.31; 'skip:- 10': 0.32; 'problem': 0.33; 'to:addr:python-list': 0.33; 'code:': 0.33; 'another': 0.33; "can't": 0.34; '2.0': 0.35; 'direction': 0.35; 'false': 0.35; 'but': 0.36; 'subject:with': 0.36; 'itself': 0.37; 'keeps': 0.37; 'does': 0.37; 'skip:v 20': 0.37; 'subject:: ': 0.38; 'sure': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'skip:u 10': 0.60; 'fuel': 0.65; 'received:80.12': 0.65; 'moves': 0.84; 'p.s': 0.84; 'email addr:hotmail.com': 0.88 Date: Mon, 07 Jan 2013 18:40:26 +0100 From: Vincent Vande Vyvre User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: problem with exam task for college References: <6f3c7fdf-7439-43b1-b3a2-da9da019b1ec@googlegroups.com> <9d4db036-b840-4c2e-8cfb-edc2afb7bbaa@googlegroups.com> In-Reply-To: <9d4db036-b840-4c2e-8cfb-edc2afb7bbaa@googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 70 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1357580886 news.xs4all.nl 6883 [2001:888:2000:d::a6]:57837 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:36365 Le 07/01/13 17:22, jeltedeproft@hotmail.com a écrit : > ok after another round of reparations, my update works again and it updates the fuel meter, but i still can't get the view of the spaceship to rotate, for now only the direction the spaceship accelerates when pressing "up" changes after a rotation, but the spaceship itself keeps pointing up. This is the code for the rotating : p.s : the problem has to be in this code because the update of the view of the position of the spaceship does work. > > > def update(self,dt): > self.velocity = self.velocity + (self.acceleration * dt) > self.pos = self.pos + self.velocity * dt > a = 0 > b = 0 > if scene.kb.keys: > a = a + 0.001 > s = scene.kb.getkey() > if (s == "up"): > if self.zicht.meter.height != 0: > self.velocity = self.velocity + self.gas > self.vlam.visible = True > b = b + 2 > self.zicht.meter.height = self.zicht.meter.height - 0.1 > self.zicht.update > if (s == "left"): > self.gas = rotate(self.gas,angle = math.pi/10, axis = (0,0,1)) > (x,y,z) = self.frame.axis > self.frame.axis = (x,y,z-0.1) > if (s == "right") : > self.gas = rotate(self.gas,angle = -(math.pi/10), axis = (0,0,1)) > (x,y,z) = self.frame.axis > self.frame.axis = (x,y,z+0.1) > if (a == 0): > self.vlam.visible = False Are you sure with this code: (x,y,z) = self.frame.axis ? frame.axis is a 'cvisual.vector' and this unpacking cause a program crashes with a segfault. For left-rigth moves of the LEM, this code seems works: -------------------------------------- if scene.kb.keys: key = scene.kb.getkey() if key == "left": # Set left deviation self.frame.axis -= (0, 0, 0.05) self.gas = vector(-sin(self.angle), cos(self.angle)) elif key == "right": # Set right deviation self.frame.axis += (0, 0, 0.05) self.gas = vector(sin(self.angle), cos(self.angle)) elif key == "up": self.deviate() def deviate(self): # Set modified velocity self.frame.velocity += self.gas self.frame.pos += self.frame.velocity # Reset falling velocity self.frame.velocity -= self.gas -------------------------------------- with angle = PI / 2.0 -- Vincent V.V. Oqapy . Qarte . PaQager