Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7943917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:24:35+00:00 2026-06-04T00:24:35+00:00

I am currently making a golf ball game using C# and XNA. So far

  • 0

I am currently making a golf ball game using C# and XNA.
So far I have been able to make the ball fly, bounce, and roll, while displaying the position and velocity.
Now I want to be able to see the ball path (similar to images below), in order to check the whole ball movement.

http://www.golf-simulators.com/images/ms4.jpg

My code updates the ball position at a fixed time interval. I am thinking of:

  1. using these position,
  2. insert them to an array of VertexPositionColor[],
  3. and draw them using GraphicsDevice.DrawUserPrimitives() method

but I have no luck so far, the VertexPositionColor is static array, while the amount of position data is always increasing.

I am thinking of using List, but the GraphicsDevice.DrawUserPrimitives() method refuse to take that as an input

    protected override void Draw(GameTime gameTime)
    {

    trail_vertice = new VertexPositionColor;
    trail_vertice.Position = Position;
    trail_vertice.Color = Color.Black;
    trail_amount += 1;
    trailList.Add(trail_vertice);
        
    basicEffect.CurrentTechnique.Passes[0].Apply();
    graphics.GraphicsDevice.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.LineStrip, trailList, 0, trail_amount);

    }

I do not need advanced effects like using particle engine. Just a single line is enough. Any suggestion?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T00:24:37+00:00Added an answer on June 4, 2026 at 12:24 am

    The C# List<> class has a handy .ToArray() function on it that you can call each time you want to draw the primitives.

    graphics.GraphicsDevice.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.LineStrip, trailList.ToArray(), 0, trail_amount);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently making a C++ game. I have my main loop during which the
I am currently making a fullscreen game and I want to be able to
I am currently making a game for the iPad and iPhone using cocos2d, Box2D
currently making a SOAP request using Java's SOAPConnectionFactory and SOAPConnection 's .call() method, which
I am currently making an MP3 player in WPF, and I want to make
I'm currently making a game in XNA4 for Windows phone 7, and I'd like
I'm currently making a webpage and I have run in to some problems with
I am currently making an app that will have multiple timers, which are basically
I'm currently making ipad application. I have create an uiviewcontroller which is appear with
I am currently making this text-based rpg game with a simple GUI. I was

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.