My votes are gone too :P Not that I need them, but I was feeling good that people are appreciating what I'm doing...
Even though I'm an artist throughout the years spent in coding I started to see that the programming is actually the real art :) .
My votes are gone too :P Not that I need them, but I was feeling good that people are appreciating what I'm doing...
Even though I'm an artist throughout the years spent in coding I started to see that the programming is actually the real art :) .
Thank you Eddy, yes I did it in a similar way you described, fortunately last night when I was scrolling down Google results(again....) I found this article: Preserving the players rotation on rotating platforms : Unity3D[^] The user there experienced the exact same problem as mine and he managed to solve it by changing the 'localRotation' to 'rotation' in the MouseLook.cs class from the standard Unity FPS controller, here is the code for the fix(this is the last if... statement from LookRotation void:
if (clampVerticalRotation)
m_CameraTargetRot = ClampRotationAroundXAxis(m_CameraTargetRot);
if (smooth)
{
character.localRotation = Quaternion.Slerp(character.localRotation, m\_CharacterTargetRot,
smoothTime \* Time.deltaTime);
camera.localRotation = Quaternion.Slerp(camera.localRotation, m\_CameraTargetRot,
smoothTime \* Time.deltaTime);
}
else
{
//comment the original rotation:
//character.localRotation = m\_CharacterTargetRot;
//put this line to fix the rotation when parenting:
character.rotation = m\_CharacterTargetRot;
camera.localRotation = m\_CameraTargetRot;
}
I'm sooo very glad I found this solution it saved my *ss :D I'm sharing it, so anyone who have similar problem might benefit.
Even though I'm an artist throughout the years spent in coding I started to see that the programming is actually the real art :) .
Hello guys, I'm making a small 3D platformer game with Unity, and I got some serious troubles making the player to walk on the rotating platforms, actually it turns out that it is absolutely impossible for me, I really tried everything, I've read probably all articles in the web about rotating platforms, parenting and so on, but nothing seems to help, even though the problem looks very simple. What I'm doing is when the player jumps on the platform I make him a parent to that platform so he cam move with it, but in the moment I set him as a parent he turns at some degrees left or right(probably depending in the differences between the angle of the platform rotation and the angle of the player), here is a video that illustrates the problem: err - YouTube[^] I really have no idea why this happens and I'm so desperate nothing seems to work and if I can't fix it there is no point in continue making the game :(( Here is my code for parenting to the rotating platform:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityStandardAssets.Characters.FirstPerson;
public class PlatformRide : MonoBehaviour
{
public GameObject _parent;
private GameObject _player = null;
// Use this for initialization
void Start()
{
transform.gameObject.GetComponent().isTrigger = true;
}
// Update is called once per frame
void LateUpdate()
{
if (!Globals.GamePaused)
{
\_parent.transform.localRotation = transform.rotation; // rotate the parent with the platform
}
}
void OnTriggerEnter(Collider col)
{
if (col.name == "CCLSSF\_player")
{
\_player = col.gameObject;
\_player.transform.parent = \_parent.transform;
}
}
void OnTriggerStay(Collider col)
{
if (col.name == "CCLSSF\_player")
{
\_player = col.gameObject;
\_player.transform.parent = \_parent.transform;
}
}
void OnTriggerExit(Collider col)
{
if (col.name == "CCLSSF\_player")
{
\_player.transform.parent = null;
\_player = null;
}
}
}
I'm using the standard Unity FPS Controller, what could be wrong? Please help, thank you in advance.
I really can't understand why there's so many people that complaining from that blue screen... I get blue screens extremely rare: Maybe the 1st time i saw it it was back in 1998 when I was still very young PC user: I have installed the wrong driver for my sound card on my old Windows XP machine. The second time I've got blue screen was when my fan of the GeForce4 VGA have stopped working, the card was baked. I remember few other times getting a blue screen, but again the reason was either a defective hardware or wrong drivers installed. BTW I've never seen a blue screen on my win7 laptop, and I have it for 3 years.
Oh gosh I finally solved the problem it is in this reference: Microsoft.VisualBasic.PowerPacks.VS I was using print to file option of the PrintForm dialog in Visual basic power packs when I remove that reference everything start working fine again and now I'll made it before the deadline, thank you for all advices :) :) :)
This is all code that resides inside Form_Load event: imgMain.AllowDrop = True 'picture box control strDefDir = My.Computer.FileSystem.CurrentDirectory Me.SetStyle(ControlStyles.DoubleBuffer, True) Me.SetStyle(ControlStyles.UserPaint, True) Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True) Me.UpdateStyles() penRegionPen = New Pen(Brushes.Black, intCropPenSize) penMyPen = New Pen(Brushes.Lime, intCropPenSize) penMyPen.DashStyle = DashStyle.Solid penMyPen.Width = 1 I've put this iside 'Try.. End Try' statement but the problem still exist and it gives me this error window(this time i put the original error window, sorry for showing it so late, I didn't thought that the problem might be so serious): http://www.mediafire.com/imageview.php?quickkey=jmddjtvzzjm[^] And this error is occuring only on my Win XP machine, on my Win 7 laptop there is no problems at all. This is all references that my project uses: Microsoft.VisualBasic.PowerPacks.VS System System.Core System.Data System.Data.DataSetExtensions System.Deployment System.Drawing System.Windows.Forms System.Xml System.Xml.Linq Tommorow I'm going to test my applications on other XP machines, I hope that the problem is in my PC and not in the application...
The screenshot I provided are just example of the kind of error dialog I get. And yes the application crashes right on the startup.
No, it is not from 'Release' directory its from 'Debug' and there is no problem with exceptions, because if the problem were exception, then the error message window would look like this: http://www.comlinktechnologies.com/error.JPG[^] but the error window i get looks like this one: http://1.bp.blogspot.com/_YxqJFnCxl14/Se8CsD4nmEI/AAAAAAAAAIY/pVsP55EUl3c/s400/excel.bmp[^]
Hi I'm currently developing graphics manipulation program with GDI+ under Visual Studio 2010 Ultimate RC - the language is Visual Basic. I'm writing the program on my laptop and I test it on my desktop PC, my desktop PC is: OS: Windows Xp SP2 .NET Framework 3.5 SP1 CPU: 1.8GHz P4 Northwood RAM 1GB My Laptop is: TravelMate 5720G OS: Windows 7 Ultimate .NET Framework 4 The application I'm developing uses GDI+ for all graphics manipulations. My project framework is .NET 3.5 SP1. The compiled executable used to work fine on my old desktop PC, but today I tried to start it and windows XP gave me the following error: '(myprogram)has encountered a problem and needs to close. Send Error Report/Don't send' The program I'm developing is for educational purposes in educational centre near my town and there teachers have only two PC with windows vista and others run on XP, so its very important for me to get my app working on XP. Thank you in advance.
Hi, I'm currently having a big problem with freehand drawing. I want to do the following thing: I want to draw 2 freehand lines both with different colors and I need the final line to be on the top of the other lines created before. To store the lines I use 2 GraphicsPath objects, one GraphicsPath per color. I tried to solve this problem by using two arrays like this: Public MousePath0() As System.Drawing.Drawing2D.GraphicsPath Public MousePath1() As System.Drawing.Drawing2D.GraphicsPath My idea was to make a system which will remember the order of all lines and draw them correctly, but when I add an graphics path to the array and when I try to add line to this graphics path VB 2008 gives me an error "Object reference not set to an instance of an object." Please help, I don't want to use exactly a GraphicsPath for the lines, it can be something different. Thank you!
Hi everybody I'm currently developing a 2D RPG game like diablo 2. And this year I finally finished the physics engine :) . For drawing the objects I use GDI+. Now I'm working on the level editor and I want to give more freedom for the level designers like giving them the option to decide by their own which regions of the map shall be impassable. The point is to give them a pen tool which they can use to freehand draw the impassable regions - something like Microsoft inkball game(http://www.windowsvistauserguide.com/vista2/games/inkball3.JPG) where you draw a line and when the ball touches the line it bouns from it. For that pen tool I use System.Drawing.Drawing2D.GraphicsPath function - the problem I have is that I don't know how to provide to the level designer a tool for erasing the created impassable regions - do you know a way to erase part of graphic created with System.Drawing.Drawing2D.GraphicsPath function? I've read an article where you can "erase" the created line by drawing another one with the same background color as the containing control but it just didn't work in my case because for background I don't have a solid color but a complex bitmap texture and objects like units and buildings. Please help, thank you in advance and sorry for my bad english.
Thank You for the fast answer! I solve the problem and now I can save and open the array in binary file format! :)
Hi, I'm currently working on a program where I have very big Integer array - with 81000000 elements. I want to keep this array and the information within for future work, is there a way to save that big array in file, and then to restore the array from that file? Thank you in advance!
I've never heard before that PNG is compressed is there an uncompressed PNG format? I'm currently learning C++ but I'm only on the beginning so I can't move that fast to XNA, cause as I know XNA requires C++ or C#.
Hi, I'm currently working on a 2D game engine for my RPG. Now the work on the physics engine is almost done, but the graphics are seems to be the biggest problem. I'm using VB 2008 and for the graphics - GDI+ . Almost all of the objects in my game are *png images, with smooth shadows and so on... I'm drawing the objects using two methods: the first one sets the drawing priority so that no one player can step on the head of other players. The second one is the loop that draws all the objects(players and textures) on the playground, that loop uses the GDI+ Graphics.DrawImage function and all this code looks like this: 'this subroutine sets the draw priority: Sub SetObjDrawPriority() For i = 0 To UBound(HBD) Select Case HBD(i).booIsAlive Case True intDrawPriority(i) = HBD(i).intTop End Select Next Array.Sort(intDrawPriority) End Sub Sub DrawAllObjects(ByVal e As System.Windows.Forms.PaintEventArgs) Try SetObjDrawPriority() For i = 0 To UBound(HBD) For i2 = 0 To UBound(HBD) If HBD(i2).intTop = intDrawPriority(i) Then e.Graphics.DrawImage(HBD(i2).bmpFace, HBD(i2).intLeft, _ HBD(i2).intDrawTop, HBD(i2).intWidth, HBD(i2).intObjDrawHeight) End If Next Next Catch ex As Exception End Try End Sub If I use *bmp texture for the objects with this size: 51 x 86 I can move simultaneously more than 200 objects on the visible area of the screen which is great, but If I replace the *bmp with *png images(with the same size: 51 x 86) the performance goes so bad that I can move normally less than 40 objects! Please tell me whats wrong. Is there any problem with the GDI+? I heard that GDI+ is wery slow and most of the programmers avoid it. I think that the code is pretty simple, but anyway maybe I'm wrong, please tell me how to optimize the code in case to get better performance. Thank you.
Thank you for the advices, the moving objects I use are actually windows forms, and I'm not comparing all those 81000000 elements with each other - the logic is different but very long to explain in the forum. Now I've just turned off the collision detect system and for my big surprisse I've noticed that nothing is changed - again If I put more than 100 objects(windows forms) to move arund my desktop - the performance is the same as if the collision detect statements are turned on. I suspect that using windows forms as units in the playground field is a bad idea, I think that windows ust can't redraw smoothly the new positions of that much forms. You can try this by yourself to see I move 100 System.Windows.Forms.Form objects around my desktop using the following code: Public Class frmMain Private Sub frmMain_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown Select Case e.KeyCode Case Keys.W For Each frmHero As System.Windows.Forms.Form In Me.OwnedForms frmHero.Left += 5 frmHero.Top += 5 Next Case Keys.C Dim frmHer As New System.Windows.Forms.Form frmHer.Show(Me) frmHer.FormBorderStyle = Windows.Forms.FormBorderStyle.None frmHer.BackColor = Color.Red frmHer.Size = New Size(5, 5) Me.Focus() Me.Text = Me.OwnedForms.Count End Select End Sub If you try this code on any machine You'll see that you can move smoothly about 100 objects(windows forms) or little more depending on the PC. Is it possible that the bad performance of my collision detect system is hidden somewhere in this characteristic of Windows OS(I use windows Vista Ultimate SP1 and Windows XP professional SP2)? I thought to try C++ with DirectX, but I still don't have money to buy these products. I heard that DirectX is optimized for game programming.
Hi everyone, I started writing programs on VB .NET in the year of 2006, reading Jim Buyens book "Faster Smarter Beginning Programming" and that's only skill I got in programming, so I could say that I'm new in writing programs. My dream was to make my own game, I searched the net to find a simple collision detect system, but all I found was "detecting collisions between 2 or three, or maximum 10 objects" which is pretty simple because there is very small count of objects and we know exactly how much they are. There was nothing like "collision detect between various number of objects", so I've made myself one using the following logic: I've created a string array which size is equal to the count of the pixels that the playground is made of - if my playground is 9000 x 9000 then the array is something like this: strWorldArr(81000000) - each element in the array represents a single pixel of the playground and all objects that move on the playground fill their name in the elements of the array using their coordinates to locate the elements of the array which represents the pixels beneath them. Here is the code of the main part of my collision detect system:
REM: checking the pixels before moving the object if the values of the array elements which they present are clean then its good to go:
Function CleanChecker(ByVal panHero As HeroBody, ByVal szeSize As Size, _
ByVal intStartPos As Integer, ByVal intEndPos As Integer, _
ByVal intCycle As Integer)
Dim intCount As Integer = 0
For i = 0 To intCycle
For e = intStartPos To intEndPos
If strWorldArr(e) <> panHero.Name And strWorldArr(e) <> "†" Then
intCount += 1
End If
Next
intStartPos += szeSize.Width
intEndPos += szeSize.Width
Next
Return intCount
End Function
REM: this subroutine cleans behind the object, or fills it's new positions:
Sub CleanOrFill(ByVal panHero As HeroBody, ByVal strChar As String, \_
ByVal szeSize As Size, ByVal intStartPos As Integer, \_
ByVal intEndPos As Integer, ByVal intCycle As Integer)
For i = 0 To intCycle
For e = intStartPos To intEndPos
strWorldArr(e) = strChar
Next
intStartPos += szeSize.Width
intEndPos += szeSize.Width
Next
End Sub
REM: this subroutine is one of 4 which call the CleanCh