Graal Forums  

Go Back   Graal Forums > Development Forums > Future Improvements
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-30-2005, 02:44 PM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Vector-Based Collision

Onwall2 is more or less sufficient for the simple movement of player characters, since they tend to travel at consistent speeds and they can be considered rectangular. However, it is pretty lacking for many other types of collision detection. Rotatable objects are a pretty good example: Rotate a square by thirty degrees and then fire it in an arbitrary direction. Odds are it won't be easy to write fast, reliable code to find out what it'll hit first.

It would be nice, then, to have a function like this:

vectorcollision({line1},{line2},time)

The two lines represent the start and end state of a single vector. It changes linearly from one to the other over a specified time (in most cases we would pass 0.05). The engine examines the path of this vector and determines if/when it will first collide with a blocking object. Then it returns the coordinates and relative time of that collision (we can return arrays, right?).

Alternatively,

vectorcollision({line},dx,dy,drotation,speed)

dx,dy give the velocity of the centre of the line. drotation gives its rate of spin (adjusted to be consistent with the velocity). Again, the engine figures out when and where the lines collides with something and returns its prediction.
__________________
Reply With Quote
 


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 On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:03 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.