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 will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
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
  snap to the curve created by the curvy splines segment points ShiroeYamamoto 0 0 16 minutes ago
Last Post: ShiroeYamamoto
Exclamation Extending Curvy Generator for Advanced Lofting - Feasibility Check amutp 2 4 Yesterday, 07:25 AM
Last Post: amutp
  8.8.0 is live, and it improves Curvy Generator greatly _Aka_ 0 5 Yesterday, 03:23 AM
Last Post: _Aka_
  Using Unity's SplineContainer in Curvy Splines dlees9191 3 14 02-26-2024, 09:49 AM
Last Post: _Aka_

Forum Jump: