Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating splines at run time
#5
Hi and thanks so much again that's a great idea and it's working, only issue is frame rates are dropping to 10fps from 400+, is this likely because it's applying the full generated mesh to it? I tried to run it in a coroutine with 0.1 second delay but it's still slow. I wonder if I need 2 generators one for building like this with a really simplified mesh (or no mesh?) and the second is then applied once the track is "layed"? Or do you think it'll still be slow just because of the calculations and the mesh isn't the issue?

Code:
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;
        if (Physics.Raycast(ray, out hit))
        {
            if (Input.GetMouseButtonDown(0))
            {
                //add the track
                track.Add(hit.point);
            }
            //move the next/last cp to mouse cursor position
            if (transform.childCount > 0)
            {
                transform.GetChild(transform.childCount - 1).gameObject.transform.position = hit.point;
            }
        }
 
Reply


Messages In This Thread
Creating splines at run time - by jamesunity - 07-16-2020, 08:35 AM
RE: Creating splines at run time - by _Aka_ - 07-16-2020, 10:47 AM
RE: Creating splines at run time - by jamesunity - 07-16-2020, 06:12 PM
RE: Creating splines at run time - by _Aka_ - 07-16-2020, 06:54 PM
RE: Creating splines at run time - by jamesunity - 07-16-2020, 07:40 PM
RE: Creating splines at run time - by _Aka_ - 07-16-2020, 08:02 PM
RE: Creating splines at run time - by jamesunity - 07-17-2020, 10:17 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Information New free asset: Converter For Unity Splines _Aka_ 5 18 04-25-2024, 11:11 AM
Last Post: _Aka_
  Help creating a wedge Thinkurvy 2 5 04-24-2024, 12:25 PM
Last Post: _Aka_
  snap to the curve created by the curvy splines segment points ShiroeYamamoto 3 11 04-02-2024, 02:24 PM
Last Post: _Aka_
Bug Changing spline connection in inspector causes splines to revert to defaults lacota 3 6 03-18-2024, 07:55 PM
Last Post: _Aka_

Forum Jump: