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 6028769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:47:20+00:00 2026-05-23T04:47:20+00:00

Im trying to create a seesaw with ball on its shape, that based on

  • 0

Im trying to create a seesaw with ball on its shape, that based on the shapes angle, the ball rolls.

Here is the screenshot of it.

enter image description here

So, the shape of the seesaw moves based on the angle generatated by a trackbar value.

Here are the variables declared:

private const float ONE_DEGREE = 0.0174532924f;
        private ID3DMesh tab;        
        private ID3DMesh ball;

The ‘tab’ variable is the shape.

This method sets the angle of the shape:

public void setShapeAngle(float degree)
{            
    tabTargetAngle = Util.DegreeToRadian(degree);
}

And here is the method that updates it:

public void Update(int elapsedTime)
        {

            if (tab.Pitch != tabTargetAngle)
            {
                if (tabTargetAngle > tab.Pitch)
                {
                    if (tab.Pitch >= (tabTargetAngle - ONE_DEGREE))
                    {
                        tab.Pitch = tabTargetAngle;

                    }
                    else
                    {
                        tab.Pitch += tabuaSpeed * elapsedTime;                        
                    }
                }
                else if (tabTargetAngle < tab.Pitch)
                {
                    if (tab.Pitch <= (tabTargetAngle + ONE_DEGREE))
                    {
                        tab.Pitch = tabTargetAngle;

                    }
                    else
                    {
                        tab.Pitch -= tabuaSpeed * elapsedTime;                        

                    }

                }

            }                                                 
        }

All of the objects, are ID3DMesh objects. Here is the code of the ID3DMesh class.

 public interface ID3DMesh : IDisposable
    {
        Color Ambient { get; set; }
        CollisionTestMethod CollisionDetectionMethod { get; set; }
        Mesh D3DXMesh { get; }
        Color Diffuse { get; set; }
        Color Emissive { get; set; }
        Material[] Materials { get; set; }
        ID3DMesh Parent { get; set; }
        float Pitch { get; set; }
        Vector3 PivotOffset { get; set; }
        float PivotOffsetX { get; set; }
        float PivotOffsetY { get; set; }
        float PivotOffsetZ { get; set; }
        Vector3 Position { get; set; }
        RenderOptions RenderSettings { get; set; }
        float Roll { get; set; }
        Vector3 Scale { get; set; }
        float ScaleX { get; set; }
        float ScaleY { get; set; }
        float ScaleZ { get; set; }
        Color Specular { get; set; }
        float SpecularSharpness { get; set; }
        Texture[] Textures { get; set; }
        Color WireColor { get; set; }
        float X { get; set; }
        float Y { get; set; }
        float Yaw { get; set; }
        float Z { get; set; }

        MeshBoundingBox GetBoundingBox();
        MeshBoundingSphere GetBoundingSphere();
        float GetDepth();
        float GetHeight();
        float GetWidth();
        Matrix GetWorldMatrix();
        bool Intersects(ID3DMesh mesh);
        void Link(ID3DMesh parentMesh, Vector3 linkPosition);
        void Move(float xAmount, float yAmount, float zAmount);
        void Render();
        void RenderPlanarShadow(Plane groundPlane, Light light, bool allowDoubleBlending);
        void SetDepth(float depth);
        void SetDepth(float depth, bool uniformScale);
        void SetHeight(float height);
        void SetHeight(float height, bool uniformScale);
        void SetPlanarShadowOpacity(float shadowOpacity);
        void SetScale(float amount);
        void SetScale(float xAmount, float yAmount, float zAmount);
        void SetSize(float width, float height, float depth);
        void SetWidth(float width);
        void SetWidth(float width, bool uniformScale);
    }

I tried to use the Move(float, float, float) method. But it didnt moved as it should. If you could help me with that.

Thank you.

  • 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-05-23T04:47:20+00:00Added an answer on May 23, 2026 at 4:47 am

    (Note: Below I’ll be ignoring the third dimension, because the ball will always move along the same plane)

    If we take the seesaw as a reference frame, I think the movement of the ball will be similar to that of an harmonic oscillator. That is to say, the position of the ball along the seesaw at a given instant of time, s(t), will be given by the following formula:

    s(t) = L cos(2π t / T + ϕ)

    where L is the length of the seesaw (the amplitude of the harmonic) and T is the time it takes the ball to move from one end of the seesaw to the other and back to the start (the period of the harmonic). ϕ, the initial phase of the harmonic, is there to adjust the formula so s(0) gives you the starting position. If you want it to start at the center, you need to make s(0) = 0, which means you need the cosine to be 0. So you have to make ϕ be π/2 (90 degrees), because cos(π/2) = 0.

    With this you can put the ball in place by changing the world transform. If you rotate it to the current angle of the seesaw (let’s call it θ(t)), you can just translate the ball by the value of s(t) along the xx axis.

    This is equivalent to treating (s(t),θ(t)) as the position of the ball in polar coordinates. You can then get the cartesian coordinates at a given time (x(t),y(t)) with these formulae:

    x(t) = s(t) cos(θ)

    y(t) = s(t) sin(θ)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to create a notification mail to my clients that have invoices due. Here
I am trying create a WCF service that leverages the WPF MediaPlayer on the
Trying to create my first iPhone app that would play back audio. When I
Trying to create a small monitor application that displays current internet usage as percentage
I am trying create a new frame in wxPython that is a child of
Ok so I am trying create a login script, here I am using PHP5
Trying to create an app that does some socket communication (Writing only). I can
Trying to create a grails ant task that has other environments besides prod for
Trying to create a simple plugin that simply connects to an ftp site, looks
Im trying to create LinqDataSource that will represent data from dynamically created String list

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.