Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Curvy Physics Disconnects on Mobile
#1
I'm away from my Home Pc, where I'm doing all of my Unity / Curvy Dev. But I compiled a version using a derivative of the Rigid Body Curvy Controller, and I got  it to work on PC, but every so often it would stop, and not continue pushing the object down the spline path. When I go on Android, it doesn't push the object at all, yet other scripts influencing the objects and other RigidBodies work fine. 

Code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using FluffyUnderware.Curvy;

public class SplineFlow : MonoBehaviour {
   public CurvySpline Spline;
   private Vector3 position;
   // Use this for initialization
   public float VSpeed, HSpeed, CenterDrag;
   float mTF;
   public Rigidbody mRigidBody;
   void Awake ()
   {
       mRigidBody = gameObject.GetComponent<Rigidbody>();
   }
   void Start () {

   }

   void FixedUpdate()
   {
       if (Spline)
       {
           var v = Input.GetAxis("Vertical") * VSpeed;            

           Vector3 p;
           // get nearest TF and point on spline
           mTF = Spline.GetNearestPointTF(transform.localPosition, out p);
           // apply forward thrust along spline direction (tangent)
           if (v != 0)
           {
               mRigidBody.AddForce(Spline.GetTangentFast(mTF) * v, ForceMode.Force);
           }
           
           
           // continously drag toward the spline to add some magic gravity
           mRigidBody.AddForce((Spline.Interpolate(mTF) - transform.localPosition) * CenterDrag, ForceMode.VelocityChange);
       }
   }
}
Reply
#2
Hi,
What version of Curvy do you use?
I am not familiar with Unity on Android, but could it be that the "Vertical" axis is not defined there?
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Reply
#3
(06-21-2018, 08:59 PM)_Aka_ Wrote: Hi,
What version of Curvy do you use?
I am not familiar with Unity on Android, but could it be that the "Vertical" axis is not defined there?

It's a 3D Application, just has some performance limits running on a mobile platform.
Windows 10 (10.0.0) 64bit
Curvy 2.3.0
2017.4.4f1

(06-22-2018, 02:21 AM)dcrosby Wrote:
(06-21-2018, 08:59 PM)_Aka_ Wrote: Hi,
What version of Curvy do you use?
I am not familiar with Unity on Android, but could it be that the "Vertical" axis is not defined there?

It's a 3D Application, just has some performance limits running on a mobile platform.
Windows 10  (10.0.0) 64bit
Curvy 2.3.0
2017.4.4f1

I think I figured it out... because I used touch
var v = Input.GetAxis("Vertical") * VSpeed; 
Wasn't doing anything because the axis weren't mapped.... I made a mistake, sorry...  Wink
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Curvy Line Renderer for UI Spline? gekido 5 13 10-29-2024, 10:19 AM
Last Post: _Aka_
  Invisible Gizmos In Latest Curvy Splines orrenravid1 1 5 06-11-2024, 07:36 AM
Last Post: _Aka_
  8.8.0 is live, and it improves Curvy Generator greatly _Aka_ 1 13 04-03-2024, 03:16 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_

Forum Jump: