• Content count

  • Joined

  • Last visited

Community Reputation

323 Neutral

About BobXIV

  • Rank
  1. Hi, I’m new to the Unity network API. I’m trying to develop a game similar to Air Soccer Fever ( I’m currently synchronizing the balls by using a NetworkView per Ball, each one with the owner has the machine that run the team. The balls are rigidbodies and a synchronize only the position making a Lerp so it is more or less smooth (I don’t know if this is the usual way when working with RigidBodies in Unity).   My problem comes when ball from say team A hits a balls from team B, because the balls from team B have as owner his player and the writer of the position is that client then even when the ball from team A moves the ball from team B it will automatically reposition because the client that “writes” the position is the client from team B. I don’t know if it is clear but that is the problem. The solution that I think would be the easiest (if possible implementing) will be changing the ownership of the NetworkView so that when it is the turn of team A his client controls (owns) all the balls, and in the turn of team B then its own all the balls. I don’t even know if this solution would be possible or if another think should be do. Any advice in this?
  2. I'm working in a wrapper to the current version of the Kinect official SDK ( from C# inside Unity. The wrapper works making called through interop to the C API of the SDK. It is working in getting the skeletal information, but I’m having problems in retrieving the depth information of the camera. The problems is because I use the C API and there is no problem in making calls to a C function but to get the depth information I need to Lock a DirectX like Texture and because it is a class in this case I don’t know how to called the member function of Texture. The idea of the code I use is (not the actual code but the basic flow of calls) :   NativeMethods.NuiInitialize(NuiInitializeFlags.UsesDepthAndPlayerIndex | NuiInitializeFlags.UsesSkeleton | NuiInitializeFlags.UsesDepth | NuiInitializeFlags.UsesColor); NativeMethods.NuiImageStreamOpen(NuiImageType.Depth, NuiImageResolution.resolution320x240, 0, 2, IntPtr.Zero, ref justDepthStreamHandle); int hr = NativeMethods.NuiImageStreamGetNextFrame(justDepthStreamHandle, 100, ref imageFramePtr); if (hr == 0)  {                 NuiImageFrame imageFrame = (NuiImageFrame)Marshal.PtrToStructure(imageFramePtr, typeof(NuiImageFrame));                   // Here must be a LOCKRECT to imageFrame.pFrameTexture                 //                 NuiImageBuffer imageBuf = (NuiImageBuffer)Marshal.PtrToStructure(imageFrame.pFrameTexture, typeof(NuiImageBuffer));                 DepthBuffer db = (DepthBuffer)Marshal.PtrToStructure(imageBuf.m_pBuffer,typeof(DepthBuffer));                                                                                hr = NativeMethods.NuiImageStreamReleaseFrame(depthStreamHandle, imageFramePtr); }     If I do the code showed before the depth image I get is not the data instead it is just junk. My guess is that it is because the texture is not locked before accessing it but the problem is that LockRect is a member function (   The layout for the variable NuiImageBuffer imageBuf that I'm using is:       [StructLayoutAttribute(LayoutKind.Sequential)] public struct NuiImageFrame {                 public Int64 liTimeStamp;                 public uint dwFrameNumber;                 public NuiImageType eImageType;                 public NuiImageResolution eResolution;                 //[MarshalAsAttribute(UnmanagedType.LPStruct)]                 public IntPtr pFrameTexture;                 public uint dwFrameFlags_NotUsed;                 public NuiImageViewArea ViewArea_NotUsed; }       Note: the code is based in a wrapper of OpenNI for Unity. There is a Kinect wrapper also based in that OpenNI wrapper but it is from an older version of the Kinect SDK. This wrappers makes the code I show without Locking but it doesn’t work for me .   The wrapper is   Thanks
  3. Problem computing GJK support points

    [quote name='greggles' timestamp='1352084345' post='4997410'] Maybe I'm missing something, but what is wrong with (0, 20)? Although it is not one of the vertices, it [i]is[/i] on the bounds of the minkowski difference. My understanding of the GJK algorithm is that it should still work correctly. [/quote] Greggles maybe I'm misunderstanding you, what you say is correct but the vertex (0,20) or any support point is indeed one of the vertices... if you mean the vertices of the Minkowski difference.
  4. Recently I saw an Indi game named "Sui Generis" (here is a video of it, it seems very interesting. There are two things that are particularly interesting: the physic interactions, the animation of the characters. My question is related to the characters animation. I want to ask how you can make something like this, I mean the movements seems very "physic driven" to call it some way. I know that Euphoria ( is a very good dynamic motion synthesizer, surely with that you can make something similar but this studio doesn’t seem to be very big so they most probably don’t have access to that kind of technology. May be the animations are simple made with Maya, 3D Studio, etc and they have a ragdoll and nothing else... but the result is very good. What do you thing guys?
  5. Hi guys, I’m having problems with an animation that uses quaternions. The problem is that the bones are given to me in the form of quaternions such that: 1) The system is right handed. 2) In particular the example of bone I want to resolve is this: [img][/img][img][/img] In my game the corresponding bone frame of reference is left handed. In particular it is: [img][/img][img][/img] So the map would be: from = +Y along arm, +X right, +Z forward to = -X along arm, -Z right, -Y forward In resume my problems are: * The quaternion of the rotation is in a left hand system * My system is right handed and with different axis Watching an example I found that the change in the quaternion seems to be: Where originalRotation is the rotation in the right hand system myRotation is the rotation in my axis Quaternion myRotation = new Quaternion(-originalRotation.y, originalRotation.z, originalRotation.x, originalRotation.w); This seems to work... but I don’t know how to get there.... it is a change of frame of reference with quaternion with a handness change... Thanks in avance
  6. Thanks for the help i could fix the problem. First try like Hodgman suggested, make operations in a small working set so i had locality in the data. This made the SSE operations as fast as expected. Then i put more operations in each loop like japro told, with that i got great results. The only thing strange is that the compiler didnt unroll my loop even if i put a bound known at compile time(iterations is a define): for(unsigned int i=0; i < (iterations-1) ;++i)//not unrolling so i put a lot of operations in each loop { //15 SSE operations } I thougth this kind of things was always optimized.... Other thing, more as a curiosity than anything else, is that the operations between inf with the fpu is EXTREMELY SLOW(i had a case when the data had an overflow, i already fixed that). I dont know if it is because some flags are set because of the inf or is something else... in the same condition the SSE operations are exactly as fast as before. [img][/img] [img][/img] PS: thanks for the links Hodgman, they are really useful.
  7. Hi guys, im having great problems with a few operations i implemented using SSE intrinsics(im using Visual Studio 2008/2010 by the way). The thing is that the performance gain i get depends to much in the operations i make. Im using single floating point presition, so i make 4 floats operations with 1 SSE instruction. When i make a SSE division(_mm_div_ps) the operation only takes 20% of what the fpu would take. With the squareroot i get even better results, something like 15% of what the sqrt(CRT) without SSE takes. But that is the only nice things. With the addition, subtraction and multiplication i get almost the same times with SSE that i get with the fpu. I dont understand how the division and squareroot could be so performing and the rest of the operations only a joke.[b] I dont know if this kind of results should be expected or im doing something really bad?[/b] I perform a few tests. Each test consist of 5000000 operations of its kind(for example only divisions). And a result is the analisis of 20 tests(60 in the case of the addition because it had higer standard deviation Gods knows why). Every test is run in [b]release [/b]with [b]speed optimizations[/b], and Enable Enhaced Instruction Set to [b]Not Set [/b](the only diference that it makes is that makes my code that runs in the fpu slower).The blue bar is the [b]average time(in seconds)[/b] of a test, and the red bar is the [b]standard deviation[/b]. Here are the results ive got: [b](NOTE: "Con SIMD" means test made with SIMD and "Sin SIMD" means test made without SIMD, ie fpu)[/b] [img][/img] [img][/img] [img][/img] [img][/img] The code for example to make an addition is: [code] ---------- Vector4.h -------------- #ifdef SIMD_EXTENSION class Vector4 { public: __declspec(align(16)) union { __m128 m_xyzw; struct { float m_x, m_y, m_z, m_w; }; }; //This union is not probably a good idea... What do you think? //Anyway i never get m_x, m_y, m_z, m_w in this test ..... inline Vector4 operator+(const Vector4 &B) const { return Vector4( _mm_add_ps(m_xyzw, B.m_xyzw) ); } .... #else class Vector4 { public: float m_x, m_y, m_z, m_w; ...... inline Vector4 operator+(const Vector4 &B) const { return Vector4( m_x+B.m_x, m_y+B.m_y, m_z+B.m_z, m_w+B.m_w ); } ..... #endif [/code] A simplified example of a call of a addition operation inside the test would be: [code] Vector4* data = (Vector4*)_aligned_malloc(iterations*sizeof(Vector4), __alignof(Vector4));//if not properly aligned everything is going to hell srand(static_cast<unsigned int>(time(NULL))); for(unsigned int i=0; i < iterations ;++i) data[i] = Vector4(static_cast<float>(rand()%100), static_cast<float>(rand()%100), static_cast<float>(rand()%100), static_cast<float>(rand()%100)); ...... later inside a test data[i] = data[i] +data[i+1]; .... other operations of addition [/code] Here is my code. There are projects for Visual Studio 2008 and 2010. [url=""]Code[/url] The examples i have seen in the web that show times always use division or squareroot... i dont know if intentionaly or what. For example: [url=""]http://software.inte...u-acceleration/[/url] [url=""][/url] [url=""]http://www.codeproje...s/sseintro.aspx[/url]