Search Results

Search found 9701 results on 389 pages for 'cross platform'.

Page 2/389 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Starting out with 2D cross-platform game development [closed]

    - by Aran
    I am wanting to challenge myself to build a simple game, that has a character and a randomly generated world. If I get anywhere with it I may perhaps I'll develop it into something more, but the key challenge I want to tackle is cross-platform. I'd also want to have a go at creating engine myself, doing lighting and other bits. Is it worth me using a system like Unity or do I go down a more custom route? The game I would like to make is a 2D game so whether that changes the tools I should use, it would be great to know as well. Supporting mobiles isn't something I am worried about at moment, just looking for Mac and Windows for time being. In future I'll consider other platforms if I get anywhere with the development. So if anyone has any recommendations for a language, engine or system to use would love to her your thoughts.Including pros and cons would be helpful and appreciated and if you can do comparisons that would be awesome as well!

    Read the article

  • Unity: parallel vectors and cross product, how to compare vectors

    - by Heisenbug
    I read this post explaining a method to understand if the angle between 2 given vectors and the normal to the plane described by them, is clockwise or anticlockwise: public static AngleDir GetAngleDirection(Vector3 beginDir, Vector3 endDir, Vector3 upDir) { Vector3 cross = Vector3.Cross(beginDir, endDir); float dot = Vector3.Dot(cross, upDir); if (dot > 0.0f) return AngleDir.CLOCK; else if (dot < 0.0f) return AngleDir.ANTICLOCK; return AngleDir.PARALLEL; } After having used it a little bit, I think it's wrong. If I supply the same vector as input (beginDir equal to endDir), the cross product is zero, but the dot product is a little bit more than zero. I think that to fix that I can simply check if the cross product is zero, means that the 2 vectors are parallel, but my code doesn't work. I tried the following solution: Vector3 cross = Vector3.Cross(beginDir, endDir); if (cross == Vector.zero) return AngleDir.PARALLEL; And it doesn't work because comparison between Vector.zero and cross is always different from zero (even if cross is actually [0.0f, 0.0f, 0.0f]). I tried also this: Vector3 cross = Vector3.Cross(beginDir, endDir); if (cross.magnitude == 0.0f) return AngleDir.PARALLEL; it also fails because magnitude is slightly more than zero. So my question is: given 2 Vector3 in Unity, how to compare them? I need the elegant equivalent version of this: if (beginDir.x == endDir.x && beginDir.y == endDir.y && beginDir.z == endDir.z) return true;

    Read the article

  • Suspended Sentence is a Free Cross-Platform Point and Click Game

    - by Asian Angel
    Do you want a fun point and click game to play on your favorite operating system? Then get ready to play Suspended Sentence! In the game you are woken from cryogenic sleep to assist in repairing the ship you are traveling on. Can you successfully complete the repairs and get your prison sentence suspended in return? Note: Suspended Sentence is available for Linux, Windows, and Mac. Suspended Sentence Homepage [via OMG! Ubuntu!] Access the Walkthrough for Suspended Sentence Latest Features How-To Geek ETC How To Remove People and Objects From Photographs In Photoshop Ask How-To Geek: How Can I Monitor My Bandwidth Usage? Internet Explorer 9 RC Now Available: Here’s the Most Interesting New Stuff Here’s a Super Simple Trick to Defeating Fake Anti-Virus Malware How to Change the Default Application for Android Tasks Stop Believing TV’s Lies: The Real Truth About "Enhancing" Images The Legend of Zelda – 1980s High School Style [Video] Suspended Sentence is a Free Cross-Platform Point and Click Game Build a Batman-Style Hidden Bust Switch Make Your Clock Creates a Custom Clock for your Android Homescreen Download the Anime Angels Theme for Windows 7 CyanogenMod Updates; Rolls out Android 2.3 to the Less Fortunate

    Read the article

  • Mobile cross-platform SDK for computationally intensive apps

    - by K.Steff
    I am aware of the PhoneGap toolkit for creating mobile applications for virtually all mobile platforms with a significant market share. However, the code in PhoneGap that is shared between the different platforms is written in JavaScript. While I like JS, I think it's hardly appropriate for computationally intensive tasks. The situation with Titanium is pretty much the same. So, is there any way that I can create a cross-platform mobile app that has the computationally intensive code shared between the platforms? Some context: Obviously, I don't want to implement the time consuming algorithm in many different languages, since this violates DRY, increases the chance for bugs slipping in at least one version and require boilerplate code to work. I've looked at Xamarin's MonoTouch and Mono for Android tools, but while they cover iOS and Android, they're not nearly as versatile for deployment as PhoneGap. On the other hand, (IMO) the statically typed nature of C# is more suited for intense computation than JS. Are there any other SDK/tools appropriate for the task that I don't know about or a point about the mentioned above that I've missed? Also, uploading data to a web service for processing is not an option, because of the traffic required.

    Read the article

  • Cross-Domain Cookie Problem

    - by Frederick
    Hi Guys, I have a domain A.com [my website] and a remote website B.com which integrates an iframe from my domain [A.com] with a piece of javascript. I want to share cookies across these domains [within the iframe]? How would I go about doing this so it works properly? I thought A.com and B.com are in the same-origin policy ?

    Read the article

  • cross-domain javascript

    - by rutherford
    I am producing a javascript-based widget. Nothing complex just a few document.writes... When I place it inline in the page it renders fine in all browsers. When I place it externally and load it via it fails to render in Firefox and IE but not Chrome. Anyone know why and a possible workaround?

    Read the article

  • Our Look at the Internet Explorer 9 Platform Preview

    - by Asian Angel
    Have you been hearing all about Microsoft’s work on Internet Explorer 9 and are curious about it? If you are wanting a taste of the upcoming release then join us as we take a look at the Internet Explorer 9 Platform Preview. Note: Windows Vista and Server 2008 users may need to install a Platform Update (see link at bottom for more information). Getting Started If you are curious about the systems that the platform preview will operate on here is an excerpt from the FAQ page (link provided below). There are two important points of interest here: The platform preview does not replace your regular Internet Explorer installation The platform preview (and the final version of Internet Explorer 9) will not work on Windows XP There really is not a lot to the install process…basically all that you will have to deal with is the “EULA Window” and the “Install Finished Window”. Note: The platform preview will install to a “Program Files Folder” named “Internet Explorer Platform Preview”. Internet Explorer 9 Platform Preview in Action When you start the platform preview up for the first time you will be presented with the Internet Explorer 9 Test Drive homepage. Do not be surprised that there is not a lot to the UI at this time…but you can get a good idea of how Internet Explorer will act. Note: You will not be able to alter the “Homepage” for the platform preview. Of the four menus available there are two that will be of interest to most people…the “Page & Debug Menus”. If you go to navigate to a new webpage you will need to go through the “Page Menu” unless you have installed the Address Bar Mini-Tool (shown below). Want to see what a webpage will look like in an older version of Internet Explorer? Then choose your version in the “Debug Menu”. We did find it humorous that IE6 was excluded from the choices offered. Here is what the URL entry window looks like if you are using the “Page Menu” to navigate between websites. Here is the main page of the site here displayed in “IE9 Mode”…looking good. Here is the main page viewed in “Forced IE5 Document Mode”. There were some minor differences (colors, sidebar, etc.) in how the main page displayed in comparison to “IE9 Mode”. Being able to switch between modes makes for an interesting experience… As you can see there is not much to the “Context Menu” at the moment. Notice the slightly altered icon for the platform preview… “Add” an Address Bar of Sorts If you would like to use a “make-shift” Address Bar with the platform preview you can set up the portable file (IE9browser.exe) for the Internet Explorer 9 Test Platform Addressbar Mini-Tool. Just place it in an appropriate folder, create a shortcut for it, and it will be ready to go. Here is a close look at the left side of the Address Bar Mini-Tool. You can try to access “IE Favorites” but may have sporadic results like those we experienced during our tests. Note: The Address Bar Mini-Tool will not line up perfectly with the platform preview but still makes a nice addition. And a close look at the right side of the Address Bar Mini-Tool. In order to completely shut down the Address Bar Mini-Tool you will need to click on “Close”. Each time that you enter an address into the Address Bar Mini-Tool it will open a new window/instance of the platform preview. Note: During our tests we noticed that clicking on “Home” in the “Page Menu” opened the previously viewed website but once we closed and restarted the platform preview the test drive website was the starting/home page again. Even if the platform preview is not running the Address Bar Mini-Tool can still run as shown here. Note: You will not be able to move the Address Bar Mini-Tool from its’ locked-in position at the top of the screen. Now for some fun. With just the Address Bar Mini-Tool open you can enter an address and cause the platform preview to open. Here is our example from above now open in the platform preview…good to go. Conclusion During our tests we did experience the occasional crash but overall we were pleased with the platform preview’s performance. The platform preview handled rather well and definitely seemed much quicker than Internet Explorer 8 on our test system (a definite bonus!). If you are an early adopter then this could certainly get you in the mood for the upcoming beta releases! Links Download the Internet Explorer 9 Preview Platform Download the Internet Explorer 9 Test Platform Addressbar Mini-Tool Information about Platform Update for Windows Vista & Server 2008 View the Internet Explorer 9 Platform Preview FAQ Similar Articles Productive Geek Tips Mysticgeek Blog: A Look at Internet Explorer 8 Beta 1 on Windows XPMake Ctrl+Tab in Internet Explorer 7 Use Most Recent OrderRemove ISP Text or Corporate Branding from Internet Explorer Title BarWhy Can’t I Turn the Details/Preview Panes On or Off in Windows Vista Explorer?Prevent Firefox or Internet Explorer from Printing the URL on Every Page TouchFreeze Alternative in AutoHotkey The Icy Undertow Desktop Windows Home Server – Backup to LAN The Clear & Clean Desktop Use This Bookmarklet to Easily Get Albums Use AutoHotkey to Assign a Hotkey to a Specific Window Latest Software Reviews Tinyhacker Random Tips DVDFab 6 Revo Uninstaller Pro Registry Mechanic 9 for Windows PC Tools Internet Security Suite 2010 Awesome Lyrics Finder for Winamp & Windows Media Player Download Videos from Hulu Pixels invade Manhattan Convert PDF files to ePub to read on your iPad Hide Your Confidential Files Inside Images Get Wildlife Photography Tips at BBC’s PhotoMasterClasses

    Read the article

  • Platform independent remote file editing

    - by Ressu
    I've been investigating possibilities on editing remote files from a website without having a need to download and upload the files manually while editing. So far I've ruled out WebDAV as a possibility since it is cumbersome to use on any platform (it either requires manual setup or works unreliably). Currently I'm looking in to various Applets, but they mostly target either uploading or downloading, not file editing. What I'm currently looking for is an applet that downloads the document, launches the application that is meant to open the file and then monitors the file for changes and uploads the changed file (either automatically or by prompting the user first). I know that I'm not alone with this scenario, so i'm looking for solutions that others have thought of.

    Read the article

  • Using C++11 for cross-platform Game Engine Development

    - by Samaursa
    Note: This is not a 'give your opinion' question about C++03 and C++11. Our game engine, written in C++03, is designed to be compiled on Windows, OSX and iOS. Linux support is planned for the (very) near future. Our experience is limited when it comes to consoles, which is why I am asking this question. Currently, we are debating whether switching to C++11 and using non-compatible features of the C++11 standard could pose a problem in the near future when we need to port our engine to any of the current gen consoles (perhaps the compilers supported by some console(s) do not support C++11 yet? We don't know...). So, game developers who have experience across multiple platforms and consoles, do you think we should stick to C++03 until the new generation of consoles arrive and most everybody has switched to C++11 standard (have they already?). Or are most consoles using/support compilers (VC++, GCC or variants?) that are already supporting C++11 features?

    Read the article

  • Webinar on Cross Platform Development with MonoTouch for the iPhone and Mono for Android on Wednesday

    - by Wallym
    The iPhone and Android are dominant in the marketplace. The two platforms currently have 85% of the smartphone marketplace and are continuing to grow that marketshare. Developers are being tasked with targeting these two platforms. In this session, we’ll take a high level look at how we can use c# and .NET knowledge to share code between iOS and and Android. We’ll look at linked files, using the Xamarin Mobile API, the challenges of running across platforms and frameworks, as well as other features of Visual Studio, Monotouch, MonoDevelop, and Mono for Android that allows us to write as much code that can run on both platforms.Here is the registration link: https://www302.livemeeting.com/lrs/8001676474/Registration.aspx?pageName=2w197495hzh0t56g

    Read the article

  • Which API for cross platform mobile audio?

    - by deft_code
    This question focuses on the API's available on phones. I'd been planning to use OpenAL in my game for maximum portability. It runs great on Linux so I can quickly develop the Game and leverage it's superior debugging tools. However I've recently heard that Android doesn't support OpenAL well. Instead they've gone with a OpenSL ES library. What I'm looking for is a free Audio library that I can use with minimal custom code on iPhone, Android, and my Linux desktop. Does such an API exists? Some extra details: The game is written in C++ with custom minimal front ends. ObjC for iPhone, Java for Android, and SFML for Desktops. I'm using OpenGL ES for portability as iPhone doesn't support the more advanced OpenGL APIs.

    Read the article

  • Debugging the NetBeans Platform

    - by Geertjan
    Once you've set up the NetBeans Platform sources as your NetBeans Platform, you're able to debug the NetBeans Platform itself. That's an occasional question (certainly not a frequent question) on the mailing list and in NetBeans Platform courses: "Is it possible to debug the NetBeans Platform?" Well, here's how: Firstly, set up the NetBeans Platform sources as your NetBeans Platform. Now, open into NetBeans IDE the NetBeans module where you'd like to place a breakpoint. That in itself is the hardest part of this task. I.e., you know you want to debug the NetBeans Platform, but have no idea where to place your breakpoint. One way to figure that out, from 7.1 onwards, is to take a visual snapshot of the NetBeans Platform and then analyze that snapshot in NetBeans IDE. To do this, right-click a module that you've set as using the NetBeans Platform sources as your NetBeans Platform and then choose Debug. The application, i.e., the NetBeans Platform, including your custom module, starts up and you'll see this, i.e., NetBeans IDE in debug mode together with your NetBeans Platform application:Notice there's a new toolbar button (new in NetBeans IDE 7.1) that resembles an orange camera. Click that button and the IDE creates a visual snapshot of the running application, which in this case is the NetBeans Platform. When you click components in the visual snapshot, the Navigator and Properties window display information about the related GUI component: By clicking the above components, you can end up identifying the component you'd like to debug and even the module where it is found. Open that module. Set a breakpoint on the line of interest. Right-click the module again and choose Debug. A debug session starts and when the breakpoint is hit, the Debugger in the IDE will open and there you can step through the NetBeans Platform sources.

    Read the article

  • Database platform migration from Windows-32bit to Linux-64bit

    - by [email protected]
    We have a customer which have all they core business database on RAC over Windows OS. Last year they were affected by a virus that destroyed the registry and all their RAC environments were "OUT OF ORDER", the result, thousand people on vacation for a day.They were distrustful about Linux and after came an agreement to migrate their Enterprise Manager from Windows to Linux (OMS and Repository). How we did demonstrate how powerful and easy is RMAN to migrate databases across platforms.Fist of check of target platform is available from sourceSQL> select platform_name from v$db_transportable_platform;PLATFORM_NAME-----------------------------------------------------------Microsoft Windows IA (32-bit)Linux IA (32-bit)HP Tru64 UNIXLinux IA (64-bit)HP Open VMSMicrosoft Windows IA (64-bit)Linux 64-bit for AMDMicrosoft Windows 64-bit for AMDSolaris Operating System (x86)Check database object as directories that can change across platforms, also check external tables.Startup source database in read only modeRun the following RMAN ScriptRMAN> connect target / RMAN> convert database on target platform convert script 'c:/temp/convert_grid.rman'transport script 'c:/TEMP/transporta_grid.sql' new database 'gridbd' format 'c:/temp/gridmydb%U' db_file_name_convert 'C:\oracle\oradata\grid','/oracle/gridbd/data2/data';(Notice tha path change on db_file_name_convert)Move from source to target:PfileNew scriptsexternal table filesbfilesdata filesCheck pfile, and ensure that the paths are OKCreate temporary control file to connect rmanExecute the RMAN scriptRMAN> connect target / RMAN> @/home/oracle/pboixeda/win2lnx.rmanShutdown the instance and remove temporary control filesRecreate controlfile/s, take care about the used paths.Execute the transport script, transporta_grid.sqlDue we were moving from a 32-bit architecture to a 64-bit architecture, there is bug reported in 386990.1 note, we had to recreate OLAP , check the note for more details. Alter or Recreate all necessary objects Launch utlrpAfter this experience with Linux they are on the way to migrate all their RAC from 10gR2 on Windows to 11gR2 Linux 64 bit.Hope it helps

    Read the article

  • Which platform to choose from .Net or Java [closed]

    - by SahilMahajanMj
    I know that there is a lot healthy discussion about this topic. but my case is entirely different from these discussions. I have just passed out my graduation. During the graduation period, i had done C#.net and java as well. Now i am working as Android programmer in a company. In the recent times, i have heard a lot about pros and cons of these platforms. What our seniors used to suggest that, ASP.net is a lot better than JSP for website developement. .net provides us lot of in built tools and API's for building powerfull applications. Java's platform independancy has always been issue among them. Security fetures are more in java. .Net has more powerfull IDE's. Now i am a bit confused on which platform to choose from these. I found java better from two, so did i prefer to choose android. Also, the discussion always ends with an issue that java has no scope for job as far has .net does. I would like to hear suggestions on this topic, but it would be better, if you consider indian IT market for this discussion.

    Read the article

  • finite state machine used in mario like platform game

    - by juakob
    I dont understand how to use a finite state machine with the entity controlled by the player. For example i have a mario(2d platform) i can jump,run,walk,take damage,swim,etc so my first thought was to use this actions as states. But what happen when you are running when you take damage? or jumping taking damage and shooting at the same time? I just want to add functionalities(actions) to the player in a clean way(not using ifs for all the actions in the entity update)

    Read the article

  • Good starting platform for a teenage games programmer

    - by gkrogers
    My son (15) has decided that he wants to pursue a career as a games programmer. I've said that he should get started now with a simple game. He has no programming experience yet, but I am a programmer (business apps, not games) so I can teach him programming, but what would be a good platform for him to start on? Initially I'm looking for something that can provide quick results, to keep his enthusiasm up. What would you suggest?

    Read the article

  • Are Colocation Cross Connects Worth While

    - by SvrGuy
    We currently operate three clusters of collocated machines in different data centers. Recently, I became aware that our newest data center will offer to cross connect us to a bandwidth provider free of charge. In the past, I never really investigated a cross connect for bandwidth because I figured that the rates would be similar to what we are paying the colo now and that it would reduce our resiliency (because we would only be using one or two carriers for IP, where as the colo uses, say 8 different providers). Then I saw an ad for hurricane electric internet services (http://he.net/cgi-bin/ip_transit_quote) that gave a price for IP transit at $1/Mbs, which is much better than the $30/Mb we pay for the blended bandwidth. What are people out there typically paying for bandwith via cross connect and how hard is to setup? Is my understanding that what you do is open agreemetns with two or three ISPs, cross connect to them and then configure your top of rack router on their network. Can you really get IP transit down to a couple of dollars per megabit per month just by doing the routing yourself? Or, is my understanding of cross connection fundamentally wrong?

    Read the article

  • Certificate error with Web Platform Installer

    - by findleyd
     A friend of mine was having an issue getting the Web Platform Installer to work on his Windows Server 2008 R2 box. He said there was some sort of cert error and asked me to try https://go.microsoft.com/fwlink/?LinkId=158722 on my local machine to see if I got the cert error.  I tried it and I did get a cert error on Windows 7 64bit. I happened to notice that that url simply redirects to https://www.microsoft.com/web/webpi/2.0/WebProductList.xml . Out of curiosity I dropped to a command line and tried to run .\WebPlatformInstaller.exe /? to see if there were any command line options. It gave an error that said invalid URI. So we tried running it with the product list url like: "WebPlatformInstaller.exe https://www.microsoft.com/web/webpi/2.0/WebProductList.xml" . This seems to get around the expired cert that is on go.microsoft.com.  Here's a screen shot of the error: 

    Read the article

  • Patterns to refactor common code in multi-platform software

    - by L. De Leo
    I have a Django application and a PyQt application that share a lot of code. A big chunk of the PyQt application are copied verbatim from the Django application's views. As this is a game, I have already an engine.py module that I'm sharing among the two applications, but I was wondering how to restructure the middle layer (what in Django corresponds to the largest part of the views minus the return HttpResponse part) into its own component. In the web application the components are those of a classic Django application (with the only exception that I don't make any use of models): the game engine the url dispatcher the template the views My PyQt application is divided into: the game engine the UI definition where I declare the UI components and react to the events (basically this takes the place of the template and the url dispatcher in the Django app) the controller where I instantiate the window object and reproduce the methods that map the views in the Django app

    Read the article

  • Choosing a crossplatform for mobile development

    - by Mech0z
    I am creating a enterprise project and will develop the app for WP, Android and IPhone (Maybe also tablets) I have then done some research of what solutions are out there and have narrowed my choice down to 3 platforms (Due to my requirement to work with Bluetooth) The biggest requirement other than Bluetooth is the need to create good interfaces and module programming so its easy to maintain the whole solution, other than that I would like to use C# but its not a real requirement, but if the difference between 2 platforms is very small then it might tip the scale. Mono (MonoTouch, Mono for android) PhoneGap RhoMobile From my understanding then PhoneGap is not suited for business apps and I am not entirely sure why, but it seems like a platform made for speed rather than long term developement, not sure how true this is. RhoMobile is made for enterprice and might suit my needs, but not sure if its a good platform Anyone with insight that care to share their opinion Mono is C#, seems to be very mature and I found MvvmCross which should help organize the project

    Read the article

  • Best platform for android and ios game?

    - by LoveMeSomeCode
    Ok, this has been asked before, but not recently, and most of the answers were just 'buy a mac'. So we're a couple guys who've been making small flash games, and now we want to go mobile, and there seem to be lots of options. Does anyone here have experience with one or more of these platforms to tell us the pros and cons of each? Corona AIR 3 Rhodes Could someone with experience compare and contrast these to each other and native development? We want to cast the widest net with the least re-work so we'd like to target just Android and iPhone, and we'd like it to be an actual app in the market instead of just a mobile website. We have experience in Actionscript, Javascript, and C#.

    Read the article

  • When should I decide what language and platforms I will use for a project?

    - by Mikalichov
    During your development process, when is the recommended phase to decide what platform to aim for, and what language to use? I figured that it would be better to choose at the beginning what would be your target platform, as it would affect your design decisions, and limit the language you are supposed to use. However, I have heard several stories of people developing their game with whatever language they were the most confident with, and then porting it to the various platforms. So, what is the best moment to choose? Before, during, after? If there is not one best choice, what factors should affect the decision?

    Read the article

  • Is there a trend for cross-platform GUI toolkits?

    - by Anto
    What is the trend like for the usage of cross-platform GUI frameworks right now? Are more people starting to use cross-platform frameworks (such as GTK+, Qt and wxWidgets) or are there more who use more platform-tied frameworks (e.g. Cocoa or WPF)? Is it more or less stagnant? Is it like a rollercoaster? What do you think the trend will be like, say, 5 years from now? The OS landscape is shifting with less people using Windows (personal observation). This should increase the demand for cross-platform toolkits, shouldn't it? Edit: Also, which (cross-platform) toolkits are growing the most, if so?

    Read the article

  • Cross platform mobile development VS Native Mobile Development: Present And Future.

    - by MobileDev123
    I just completed one year in Smart phone development, working on BlackBerry and Android and also developed one application exclusively targeted to nokia feature phones. And just a month ago I come to know about Titanium Appcelerator tool that enables cross platform development, but there are some developers who complain about it's sub-par functionalities. Even a little bit experience of mine says that developing in native environment rather than these cross platform tools will give you more advantages by giving a developer a chance to add more features with better performance. Do you have same experience? Or you find such cross development tools really useful regarding to advance functionality and performance? As porting (or co developing) same application to different mobile platform is common thing nowadays, what do you think will these cross platform tools evolve and force developers to get a hands on approach on them or majority will stick to the native development environment?

    Read the article

  • Platform jumping problems with AABB collisions

    - by Vee
    See the diagram first: When my AABB physics engine resolves an intersection, it does so by finding the axis where the penetration is smaller, then "push out" the entity on that axis. Considering the "jumping moving left" example: If velocityX is bigger than velocityY, AABB pushes the entity out on the Y axis, effectively stopping the jump (result: the player stops in mid-air). If velocityX is smaller than velocitY (not shown in diagram), the program works as intended, because AABB pushes the entity out on the X axis. How can I solve this problem? Source code: public void Update() { Position += Velocity; Velocity += World.Gravity; List<SSSPBody> toCheck = World.SpatialHash.GetNearbyItems(this); for (int i = 0; i < toCheck.Count; i++) { SSSPBody body = toCheck[i]; body.Test.Color = Color.White; if (body != this && body.Static) { float left = (body.CornerMin.X - CornerMax.X); float right = (body.CornerMax.X - CornerMin.X); float top = (body.CornerMin.Y - CornerMax.Y); float bottom = (body.CornerMax.Y - CornerMin.Y); if (SSSPUtils.AABBIsOverlapping(this, body)) { body.Test.Color = Color.Yellow; Vector2 overlapVector = SSSPUtils.AABBGetOverlapVector(left, right, top, bottom); Position += overlapVector; } if (SSSPUtils.AABBIsCollidingTop(this, body)) { if ((Position.X >= body.CornerMin.X && Position.X <= body.CornerMax.X) && (Position.Y + Height/2f == body.Position.Y - body.Height/2f)) { body.Test.Color = Color.Red; Velocity = new Vector2(Velocity.X, 0); } } } } } public static bool AABBIsOverlapping(SSSPBody mBody1, SSSPBody mBody2) { if(mBody1.CornerMax.X <= mBody2.CornerMin.X || mBody1.CornerMin.X >= mBody2.CornerMax.X) return false; if (mBody1.CornerMax.Y <= mBody2.CornerMin.Y || mBody1.CornerMin.Y >= mBody2.CornerMax.Y) return false; return true; } public static bool AABBIsColliding(SSSPBody mBody1, SSSPBody mBody2) { if (mBody1.CornerMax.X < mBody2.CornerMin.X || mBody1.CornerMin.X > mBody2.CornerMax.X) return false; if (mBody1.CornerMax.Y < mBody2.CornerMin.Y || mBody1.CornerMin.Y > mBody2.CornerMax.Y) return false; return true; } public static bool AABBIsCollidingTop(SSSPBody mBody1, SSSPBody mBody2) { if (mBody1.CornerMax.X < mBody2.CornerMin.X || mBody1.CornerMin.X > mBody2.CornerMax.X) return false; if (mBody1.CornerMax.Y < mBody2.CornerMin.Y || mBody1.CornerMin.Y > mBody2.CornerMax.Y) return false; if(mBody1.CornerMax.Y == mBody2.CornerMin.Y) return true; return false; } public static Vector2 AABBGetOverlapVector(float mLeft, float mRight, float mTop, float mBottom) { Vector2 result = new Vector2(0, 0); if ((mLeft > 0 || mRight < 0) || (mTop > 0 || mBottom < 0)) return result; if (Math.Abs(mLeft) < mRight) result.X = mLeft; else result.X = mRight; if (Math.Abs(mTop) < mBottom) result.Y = mTop; else result.Y = mBottom; if (Math.Abs(result.X) < Math.Abs(result.Y)) result.Y = 0; else result.X = 0; return result; }

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >