Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About pascalosti

  • Rank
  1. pascalosti

    Looking for free .X files

    Any suggestion on where I can get free .X files. I dont have maya/max installed on my laptop to convert formats. Not looking for anything special.
  2. pascalosti

    Networking Template

    Networking is really confusing for me. Anyone know of any templates, or simple projects I can learn or work with. I'll be working with a simple 2D game. Preferable c#xna, but c++ is okay also either or of these models WSAAsyncSelect WSAEventSelect
  3. pascalosti

    Why RotationMatrix keeps its value? xna

    How can I apply transformation only once? My thought was that every vector has to be rotated or transformed. then scaled then set to its location. // these are the vectors im going through, they always stay the same TList.Add(new Vector3(0, 0, 0)); TList.Add(new Vector3(0, 0.5f, 0)); TList.Add(new Vector3(1, 0, 0)); TList.Add(new Vector3(-1, 0, 0)); // and what my screen looks like (45angle)
  4. when I call SetTriggerMatrix() function, the object scales and rotates (it keeps rotating it does not hold the angle) It should only scale, T_Angle does not change. rotationMatrix value stays the same with each loop, I dont see why the object is turning. When I change T_Angle to 360 it does not rotate if T_Angle is 90 it iterates by 90 if (newState.IsKeyDown(Keys.Right)) { // setscale can be commented out, the object still rotates MyTriggers[MyTriggers.Count - 1].SetScale += 2.0f; MyTriggers[MyTriggers.Count - 1].SetTriggerMatrix(); } public void SetTriggerMatrix() { List<Vector3> TmpList = new List<Vector3>(); TmpList = TList; // TList always stays the same // make an angle in degrees float angle = MathHelper.ToRadians(T_Angle); //*************************************************************************** //************************Problem Area************************************** // make a rotation matrix Matrix rotationMatrix = Matrix.CreateRotationZ(angle); // Transform your line for (int i = 0; i < TmpList.Count; i++) TmpList = Vector3.Transform(TmpList, rotationMatrix); //*************************************************************************** //*************************************************************************** //this code below is not important, it just finishes off the above function // I was getting xml erros is the reason for posting this outside of the code. // scale first then add location TListVec2.Clear(); for (int i = 0; i < TmpList.Count; i++) { TListVec2.Add(new Vector2(TmpList.X * Scale + TriggerLocation.X, TmpList.Y * Scale + TriggerLocation.Y)); } } [Edited by - pascalosti on November 4, 2007 9:57:43 PM]
  5. pascalosti

    Finding the angle

    I went with your first advice, using Matrix is much easier. Thank you
  6. pascalosti

    Finding the angle

    Im getting a really odd numbers (whiteLine is original "a,b", it then points from "b" to MiddleExtension vector) Vector2 MiddleExtension = new Vector2(); float AngExtenstion = FindAngleOnLine(); MiddleExtension = T_Position[0]; MiddleExtension.X += (float)AngExtenstion * 2; MiddleExtension.Y += (float)AngExtenstion * 2; // I'm assuming I got this correct // A is index[0] B is index[1] public float FindAngleOnLine() { if (T_Position.Count >= 2) { float dotnumber = -1 * (T_Position[0].X * T_Position[1].X) + (T_Position[0].Y * T_Position[1].Y); float AMag = (float)Math.Sqrt((float) T_Position[0].X + T_Position[0].Y); float BMag = (float)Math.Sqrt((float)T_Position[1].X + T_Position[1].Y); return dotnumber / (AMag * BMag); } else return -1; }
  7. pascalosti

    Finding the angle

    The info that i have: vector2 a,b, d(middle); int length;// length of the 90degree angle How would I calculate a 90 degree angle from "a,d"? "h" is just to show how it should look like. note: h != (b.x, a.y)
  8. pascalosti

    Creating line trigger!

    I want to draw the third point that is 90degrees from the trigger, Im not sure how to figure that out? So that the trigger has an "L" shape. "A" is always the first point drawn then "B" (any direction)
  9. pascalosti

    Creating line trigger!

    The plan: Draw a line (represents the trigger) any direction. Scenario: Player walks over the trigger Looking for suggestion on how I should check which direction the line was crossed. example: if the player crosses the right side of the line to the left side of the line, the trigger has different responds then from the other direction. Pseudo is okay, but keep in mind my math is horrible.
  10. pascalosti

    How to follow a path?

    I tried it and it worked like a charm. I think ill implement your neater suggestion also. cheers
  11. pascalosti

    How to follow a path?

    edit: ill give it a try, thanks (i think post was edited or i missed the some parts) nevermind the stuff below. edit 2: Okay so it was edited (im not loosing my mind :-) ) thanks again. Yeah that would work, but your velocity would change, from one path to the next. example: n1 take 100 steps to n2 n2 take 100 steps to n3 if the distance from n2,n3 is longer then n1,n2 there will be a change of velocity. Correct me if im wrong or missed your point.
  12. pascalosti

    How to follow a path?

    Here is a much shorter code. the question is about the last line of this code divide steps? (doesnt work for me) // from devfred's help trying to get constant velocity // moving from Pathway[0] to Pathway[1] // this.SG_Position is the player/mover delta.X = PathWay[1].Data.Position.X - PathWay[0].Data.Position.X; delta.Y = PathWay[1].Data.Position.Y - PathWay[0].Data.Position.Y; int steps = (int)(Math.Sqrt(delta.X * delta.X + delta.Y * delta.Y) / 5);// 5 is the speed this.SG_Position += new Vector2((this.SG_Position.X + delta.X) / steps, (this.SG_Position.Y + delta.Y) / steps);
  13. pascalosti

    How to follow a path?

    Im not sure how steps (const velocity) is implemented, it either stays or I get super high number. Its not working yet Ill try again tomorrow public void P_Moving() { //Pathway is a List < nodes > // plus ( sign doesnt show for some reaon) if (PathWay.Count > (Counter plus 1)) { Vector2 delta = new Vector2(); delta.X = PathWay[Counter plus 1].Data.Position.X - PathWay[Counter].Data.Position.X; delta.Y = PathWay[Counter plus 1].Data.Position.Y - PathWay[Counter].Data.Position.Y; int steps = (int)(Math.Sqrt(delta.X * delta.X plus delta.Y * delta.Y) / this.P_PawnState.Speed); // I divided steps, not sure if thats correct (for constant velocity) this.SG_Position plus= new Vector2((PathWay[Counter].Data.Position.X * delta.X) / steps, (PathWay[Counter].Data.Position.Y * delta.Y) / steps); // if player is close give player new position and next target if (this.VacinityNode(30, PathWay[Counter plus 1])) { this.SG_Position = PathWay[Counter plus 1].Data.Position; Counter plus= 1; } // if 2 }// if 1 if (Counter == PathWay.Count) this.P_PawnState.State = 1;// reached target/ turn player state to "still" }// end moving function
  14. pascalosti

    How to follow a path?

    Example: Node1(50, 15) Node2(200, 100), Node3(10, 122) Player moves from Node1 to Node2, once he reaches Node2 he moves on to Node3 Pseudo code is enough, but please keep in mind my understanding of radian, sin and cos stuff is horrible.
  15. pascalosti

    c# graph help

    I was traversing breadth first, which made it hard to get paths. I created a depth first recursive function (works fine). I attempted to create one using a stack (no recursion, and it doesnt work), I feel like I need to make this way to store the trails. if some one can point out the obviouse why this function fails (my brain is dead) error: stack empty (in for loop, i is at 1) The whole function seems poorely set up public void DepthStackTraverse(Node ANode) { Stack<Node> NodeHold = new Stack<Node>(); OutPutString += "StartNode:(" + ANode.Data.Position.X.ToString() + ")"; ANode.isMarked = true; NodeHold.Push(ANode); while (NodeHold.Count != 0) { LoadChildrenStack(NodeHold); }// while }// end stack trav function public void LoadChildrenStack(Stack<Node> NodeHold) { for (int i = 0; i < NodeHold.Peek().AdjacentNode.Count; i++) { if (NodeHold.Peek().AdjacentNode == null || NodeHold.Peek().isMarked == true) { NodeHold.Peek().isMarked = true; OutPutString += ": " + NodeHold.Peek().AdjacentNode.Data.Position.X.ToString(); NodeHold.Pop(); } else NodeHold.Push(NodeHold.Peek().AdjacentNode); } } depth first recursive works fine public void DepthGraphTraverse(Node ANode) { OutPutString += ANode.Data.Position.X.ToString(); ANode.isMarked = true; for (int i = 0; i < ANode.AdjacentNode.Count; i++) { if (ANode.AdjacentNode.isMarked == false) { DepthGraphTraverse(ANode.AdjacentNode); } } }
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!