Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-12-2008, 10:51 AM   #1
lewis_evans
Registered User
 
Join Date: May 2008
Posts: 2
Default Multiple vector forces acting on a forward moving object

LO All,

I have been trying to create a platform game using vector calculations for the motion / friction /gravity / bounce etc. All is good - I have a ball bouncing merrily along off my vector floor - until the ball should come to a standstill on the floor due to the friction and lack of bounciness. then the ball just jitters on the surface when I want it to come to a standstill. What I actually want is for the ball not to bounce but stick to the surface. I think it's the gravity vector being added each time making it do this.

I know I'm being a bit vague but has anyone ever used vectors for this kind of game and if so do you have any ideas on how I can get my ball to come to rest? Do I have to hack it?



Thanks in advance

Lewis
lewis_evans is offline   Reply With Quote
Old 05-12-2008, 01:58 PM   #2
ASWC
Super Moderator
 
ASWC's Avatar
 
Join Date: Dec 2007
Location: Greenville, SC
Posts: 6,528
Default

that's one way to do it:
ActionScript Code:
var speed:Number = 40; var gravity:Number = 0.9; this.onEnterFrame = function(){     speed*=gravity;     trace(speed)     if(speed<0.01){         gravity=0;         } }
__________________
aswebcreations
Super Duper!
ASWC is offline   Reply With Quote
Old 05-12-2008, 03:30 PM   #3
lewis_evans
Registered User
 
Join Date: May 2008
Posts: 2
Default

I'm using vectors for trajectory and gravity and adding them all together. I can't just get rid of gravity. I was needing something more solid.

Thanks anyways
lewis_evans is offline   Reply With Quote
Old 05-12-2008, 04:03 PM   #4
MonkeyBiscuits
King of the Monkeys
 
Join Date: Oct 2004
Location: com.utils.house
Posts: 319
Default

Use larger values for gravity and speed, then you can use Math.floor on your algorithm to which will reduce any annoyingly small decimals to a flat zero but give you enough scope for decent movement
MonkeyBiscuits is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
writing to local shared object for multiple users sagra29 Projectors and CDs 3 08-18-2008 05:00 AM
What happened to duplicateMovieClip() ? matbury ActionScript 3.0 5 12-01-2007 11:05 PM
Object moving with the mouse.... SinisterDesign ActionScript 2.0 4 10-20-2007 06:26 PM
multiple instances of custom object hiadam ActionScript 2.0 3 12-12-2006 11:35 PM
Multiple forces acting on elastically moving object bitterclarence Animation and Effects 3 04-28-2005 03:18 PM


All times are GMT. The time now is 02:50 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.