fehaar / FFWD

This is the FFWD framework for XNA, that allows you to port Unity3D games to XNA for use on WP7 or XBox360 (XBLIG)
Microsoft Public License
133 stars 36 forks source link

Rigidbody issue #50

Closed stanleyjoy closed 12 years ago

stanleyjoy commented 12 years ago

I tried a exporting a simple scene which contains

fehaar commented 12 years ago

The 2D physics in FFWD works in XZ space, as this is how you generally would set up a 2D rendered scene. You can change this globally by changing the to2Dmode in Collider to something else. This should be done in your Game1.Initialize, before initializing the FFWD framework. The same goes for Gravity that is disabled by default and should be set before initializing.

stanleyjoy commented 12 years ago

Are you saying that I need to work on Game1.cs to get the Physics to work. Can you give me an Idea of what I should be doing. Coz I did not understand what you said in the previous post. Stan

fehaar commented 12 years ago

All right. I will see if I can explain it better. But I just realized that that things weren't that easy after all. Especially turning the 2D world globally is not possible from the outside. I have just pushed a quick patch for that now, so merge that in and you should be able to put the following into Game1.Initialize and have things work better for you:

ApplicationSettings.Physics_Default2DMode = Physics.To2dMode.DropZ; Physics.gravity = new Vector3(0, 9.82f, 0);

I have not tested that it works, mind you. So please let me know if you still have issues.

Thomas Gravgaard Senior Software Developer Press Play ApS thomas@pressplay.dk +45 26 74 26 74

stanleyjoy commented 12 years ago

Where can i get the patch??? Plus I tend to get annoyed with this Ambiguous reference. The Vector3 that you have used is clashing with Xna.Framework Vector3 and another one that is made in PressPlay.FFWD. Is there a work around for this or should I always type in the entire namespace from where it is derived from?? Stan

fehaar commented 12 years ago

I have pushed it to Github.

Oh. The references... They are extremely annoying, but there is nothing we can do about it. I usually have Game1 working in "XNA space" so there I usually prefix FFWD by using these in the top of the file:

using FFWD = PressPlay.FFWD; using FFWDc = PressPlay.FFWD.Components;

The scripts and the FFWD framework code is obvoiusly in "FFWD space" so there I prefix the XNA references directly. I have not used using aliases there though.

stanleyjoy commented 12 years ago

I got the patch But i had posted some errors over there. Stan

stanleyjoy commented 12 years ago

The shader that is used is very dull and I was wondering if we can change to any other shader. Stan

fehaar commented 12 years ago

If you are running on WP7 you are out of luck as you cannot use custom shaders at all on that platform. Most setting on the built-in shader can be tweaked through Unity, and you can pep things up by doing lighmapping - but that is more or less it. If you are on the XBox you can do it - but there is no support for it in FFWD at all right now, so you would have to do some work deep down in the belly of the beast.

stanleyjoy commented 12 years ago

I am wondering what shader to use to make a sprite look bright. We don't use light for the sake of performance, so we normally use Sprite Cutout.shader in Unity. What I am asking is simple, what shader would you use on FFWD WP7 when you don't use directional light for a sprite sheet? Stan

stanleyjoy commented 12 years ago

I am wondering what shader to use to make a sprite look bright. We don't use light for the sake of performance, so we normally use Sprite Cutout.shader in Unity. What I am asking is simple, what shader would you use on FFWD WP7 when you don't use directional light for a sprite sheet? Stan

stanleyjoy commented 12 years ago

I am wondering what shader to use to make a sprite look bright. We don't use light for the sake of performance, so we normally use Sprite Cutout.shader in Unity. What I am asking is simple, what shader would you use on FFWD WP7 when you don't use directional light for a sprite sheet? Stan

fehaar commented 12 years ago

The easy anser is BasicEffectShader - because that is what is used in XNA. But that shader is a jack-of-all-trades that can be used with or without lighting, textures, vertex colors and so on. So it can be used in nearly every case. If you are just using sprites, you will probably want to disable all lighting (don't put any lights in the Unity scene). Then the shader will be texture-only and won't use vertex coloring so you can easily control how it looks.

stanleyjoy commented 12 years ago

How do I go about using this shader? Stan

fehaar commented 12 years ago

You are already using that shader in XNA. The trick is HOW you are using it as I said. FFWD will try and determine what is in the scene and discover the settings automatically. So it will look at the material you are using and see if there are any lights in the scene and take things from there. It sounds much more complicated than it is. Take a look at the code in BasicEffectShader.ApplyPreRenderSettings in FFWD or the corresponding code in DynamicBatchRenderer.DoDraw if you are using the (old) fallback rendering system. There you can see code for enabling/disabling lights and texture and so on. That is what controls the way the shader is used.

stanleyjoy commented 12 years ago

Oh Cool!! I got it working man. You the dude!!! Stan

stanleyjoy commented 12 years ago

Hey, does FFWD create a .meta file for every folder and file that is created in Unity?? Stan

fehaar commented 12 years ago

No. Unity does that when you have external version control enabled - like when you use git - which is why the files are there. If you use Asset Server or gasp no version control - you can safely ignore them. ;-)

stanleyjoy commented 12 years ago

ok cool